题解 | #Array.map#

Array.map

http://www.nowcoder.com/practice/8300c998180c4ebbbd2a5aaeb7fbc77c

Array.prototype._map = function (fn){
    if(typeof fn !== "function") return ;
    let arr = [];
    for(let i = 0;i<this.length;i++){
      arr.push(fn(this[i],i,this))
    }
    return arr;
}
全部评论

相关推荐

评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务