Skip to content

Instantly share code, notes, and snippets.

@flexaddicted
Created January 27, 2019 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flexaddicted/3869a2927e69ccfd7b1c04328cbceb5d to your computer and use it in GitHub Desktop.
Save flexaddicted/3869a2927e69ccfd7b1c04328cbceb5d to your computer and use it in GitHub Desktop.
Array.prototype.myMap = function(fn) {
const elements = [];
for(let i = 0; i < this.length; i++) {
elements.push(fn(this[i]));
}
return elements;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment