Javascript Array myInject()
myInject()
//without callback Array.prototype.myInject = function() { var sum = this[0]; for(var i = 1; i < this.length; i++) { sum += this[i];/*from ww w . j a v a 2s. c o m*/ } return sum; }