const arr = [{ name: '张三', salary: 10000 }, { name: '李四', salary: 15000 }, { name: '王五', salary: 20000 } ] // 计算薪资 let sum = arr.reduce(function (prev, current) { // console.log(current) return prev + current.salary }, 0) console.log(sum)