Node.js examples for Algorithm:Statistics
Get average from array
function getAvg(array){ var sum=0;//from w w w .j av a2 s .c om for (var i=0;i<array.length;i++){ sum += array[i][1]; } var avg = sum / array.length; return parseFloat(avg).toFixed(2); };