Map array element one by one - Node.js Array

Node.js examples for Array:Array Operation

Description

Map array element one by one

Demo Code


Array.prototype.map = function (handler) {
    var result = []

    for (var i = 0; i < this.length; i++) {
        result.push(handler(this[i]))//from w w w  . j av a2  s  .co  m
    }

    return result
}

Related Tutorials