ES6 - Math max() 函数
此方法返回零个或多个数字中的最大值。如果没有给出参数,则结果为 –Infinity。
语法
Math.max(x1,x2,x3..)
参数
- X1,x2,x3.. − 表示一系列数字
示例
console.log("---Math.max()---") console.log("Math.max(3, 0.5, 0.66) : "+Math.max(3, 0.5, 0.66)) console.log("Math.max(-3, 0.5, -0.66) : "+Math.max(-3, 0.5, -0.66))
输出
---Math.max()--- Math.max(3, 0.5, 0.66) : 3 Math.max(-3, 0.5, -0.66) : 0.5