大概手写一下吧。
Array.prototype.map( x => x+1)
//实现一个map1
Array.prototype.map1= function (callback){
let newArr = [];
let that = this;
for(let i=0;i<that.length;i++){
newArr.push(callback(that[i]));
}
return newArr;
}
[1,2,3,4,5].map1(x=>x+1)