编辑代码

Array.prototype.myMap = function (fn) {
  return this.reduce((prev, next, index, array) => {
    return [...prev, fn(next, index, array)];
  }, []);
};