📌  相关文章
📜  javascript 按键求和数组值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:19.945000             🧑  作者: Mango

代码示例1
var array = [
  {name: "Peter", age: 43},
  {name: "John", age: 32},
  {name: "Jake", age: 21}
];

array.reduce(function(sum, current) {
  return sum + current.age;
}, 0); // 43 + 32 + 21 = 96