Node.js examples for Array:Sum
Sum all elements from array
Array.prototype.sum = function() { var sum = 0;// www . java 2 s . c o m for (var i = 0, l = this.length; i < l; i++) { sum += this[i]; } return sum; };