定义 定义reduce方法对数组中的每个元素执行一个自定义的reducer函数,并将其结果汇总为单个返回值 const arr = [1, 2, 3, 4, 5]const reducer = (acc, cur) => { acc + cur }arr.reduce(reducer)