📌  相关文章
📜  javascript 计算数组的平均值 - Javascript 代码示例

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

代码示例3
const sum = times.reduce((a, b) => a + b, 0);
const avg = (sum / times.length) || 0;

console.log(`The sum is: ${sum}. The average is: ${avg}.`);