Javascript Array reduce(pasteback, initial)

Description

Javascript Array reduce(pasteback, initial)


/**/*from  w  w  w  .  j  a v  a 2s  . c  o  m*/
 * 1.8 functions for js.js 
 */
'use strict';

Array.prototype.reduce = function(pasteback, initial){
 for(var i = 0
    , c =  this.length
    , value = arguments.length>1 ? initial : this[i++]
 ; i<c; i++){
  value = pasteback(value, this[i], i, this);
 }
 return value;
};



PreviousNext

Related