Javascript Array sum(prop)
Array.prototype.sum = function (prop) { var total = 0; for ( var i = 0, _len = this.length; i < _len; i++ ) { total += this[i][prop]// w w w . j a v a 2 s. co m } return total; };