修改原型给数组对象添加forEach

 Array.prototype.forEach = function (callback, context) {
        for (var i = 0; i < this.length; i++) {
            callback.call(context || null, this[i], i, this);
        }
    }
    var arr = ["a", "b","c"];
   arr.forEachs(function (value, index, array) {
        debugger;

    });
原文地址:https://www.cnblogs.com/gaocong/p/6627270.html