Javascript Array map(iterator)

Description

Javascript Array map(iterator)


Array.prototype.map = function(iterator) {
  var results = [];
  for (var i = 0, len = this.length; i < len; i++) {
    results.push(iterator(this[i], i));/*from   ww  w  .  ja va2 s  .c o m*/
  }
  
  return results;
};



PreviousNext

Related