📌  相关文章
📜  获取平均值和总和 javascript 代码示例

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

代码示例1
var sum = array.reduce((a, b) => a + b, 0);    //get sum of all elements in array
var avg = (sum / array.length) || 0; //get average of all elements in array ;)