JS中的数组排序sort()和数组求和reduce()可接受函数作参数

reduce() 方法接收一个函数做为累加器,数组中的每一个值(从左到右)开始缩减,最终计算为一个值javascript var numbers = [65, 44, 12, 4]; function getSum(total, num) { return total + num; } mm=numbers.reduce(getSum); conso
相关文章
相关标签/搜索