js中Math.max()求取数组中最大值

let arr = [3,2,4,1,8,6]
let maxValue = Math.max.apply(null,arr);
console.log(maxValue);

PS: Math.max()中的参数不可以传数组

let arr = [3,2,4,1,8,6]
let maxValue = Math.max(...arr);
console.log(maxValue);
原文地址:https://www.cnblogs.com/manru75/p/10409882.html