Javascript Array map( fn ) method

Description

Javascript Array map( fn ) method


Array.prototype.map = function( fn )
{
    var a = [];//from  www . j  a  v  a  2 s  .co  m
    for( var i = 0; i < this.length; i++ ) {
        if( i in this ) a.push( fn( this[ i ] ) );
    }
    return a;
};



PreviousNext

Related