Math.max应用于数组
2017-03-21 本文已影响14人
u14e
let values = [3, 5, 8, 321, 54];
let max = Math.max.apply(Math, values);
console.log(max);
let values = [3, 5, 8, 321, 54];
let max = Math.max(...values);
console.log(max);
let values = [3, 5, 8, 321, 54];
let max = Math.max.apply(Math, values);
console.log(max);
let values = [3, 5, 8, 321, 54];
let max = Math.max(...values);
console.log(max);