Javascript Array map(a)

Description

Javascript Array map(a)

Array.prototype.map = function(a) {
  const array = new Array(this.length)
  for (let i = 0; i < this.length; i++) array[i] = a(this[i], i, this)
  return array/*from ww w .j av  a 2 s  .com*/
}



PreviousNext

Related