很是快速簡單的進行求和計算...bash
const array = [{a: 1, num: 100}, {b: 2, num: 200}]; const total = array.reduce((p, e) => p + e.num, 0); console.log(total); // 300複製代碼