📅  最后修改于: 2022-03-11 15:01:42.890000             🧑  作者: Mango
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 ;)