题解 | #Array.reduce#

Array.reduce

http://www.nowcoder.com/practice/213d0ef21cb841de8cf69fcc5ea60eb6

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

相关推荐

鱼专:别投了,我看到有人点了第二个链接投递,还没退出界面,不合适的邮件就发过来了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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