let arr = [1, 32, 41, 2, 1312, 41, 1, 321]
// map方法是返回原来的数组
Array.prototype._map = function (fn) {
if (typeof fn !== "function") {
throw new TypeError('Not Function')
}
let res = []
for (let i of this) {
fn(i) && res.push(fn(i))
}
return res
}
console.log(arr._map(x => x * 2));