JS练习_reduce()求数组中最大值或最小值
时间:2021-09-13 12:13:41
收藏:0
阅读:32
// 获取数组中最大值
var arr = [134798, 3478973, 12, 345, 355, 425, 1342356, 3425566, 7908798]
var max = arr.reduce(function (prev, next) {
return Math.max(prev, next) // Math.min(prev, next)
}, 0)
console.log(max)
原文:https://www.cnblogs.com/zhuhukang/p/15259317.html
评论(0)