Math.max
Math.max(value1, value2);
若想处理数组中的值:
let values = [25, 50, 75, 100]
console.log(Math.max.apply(Math, values)); // 100
ES6的方法:
let values = [25, 50, 75, 100]
// 等价于 console.log(Math.max(25, 50, 75, 100));
console.log(Math.max(...values));
let values = [-25, -50, -75, -100]
console.log(Math.max(...values, 0));