Javascript Array sum(array)
Array.prototype.sum = function(array) { return this.reduce(function(a,b) { return a + b }) /*from w w w . ja v a 2s . c o m*/ }