Math.max()是求最大值,Math.min()是求最小值

Math.max(value1,value2,value3....)

但是如果是数组或者对象呢?

var numArr = [1,2,4,6,76]

Math.max.apply(null,numArr)

或者 Math.max(...numArr)  //76,使用拓展运算符

如果是对象,可以将对象的属性值放入一个数组,然后使用上面两种数组的方法进行求最大最小值。

相关文章:

  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2021-08-29
  • 2021-07-15
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案