JS数组获取值:
var numbers = [5, 458 , 120 , -215 , 228 , 400 , 122205, -85411]; var maxInNumbers = Math.max.apply(Math, numbers); var minInNumbers = Math.min.apply(Math, numbers);
ES6写法:
let minNum = Math.min(...numbers);
console.log(minNum);
js获取数组中最大最小值
猜你喜欢
转载自www.cnblogs.com/agen-su/p/11635632.html
今日推荐
周排行