Array.prototype.forEach = function(cb){
var self = this;
for(var i=0;i<this.length;i++){
(function(i){
cb(i,self[i],self)
})(i)
}
}
var arr = [1,5,3];
arr.forEachDiy(function(i,item,arr){
console.log(i)
console.log(item)
})
网友评论