Node.js examples for Array:Sum
Use for loop to sum elements from array
Array.prototype.sum = function () { var sum = 0;/* ww w.j a v a 2 s. co m*/ for (var i = 0, l = this.length; i < l; i++) { sum += this[i]; } return sum; };