Skip to content

Instantly share code, notes, and snippets.

@HashirHussain
Created October 4, 2023 05:29
Show Gist options
  • Save HashirHussain/18e0ef21711814f39e357be8ebd9ef36 to your computer and use it in GitHub Desktop.
Save HashirHussain/18e0ef21711814f39e357be8ebd9ef36 to your computer and use it in GitHub Desktop.
Array.prototype.map clone
Array.prototype.myMap = function(callback) {
const result = [];
for(let i = 0; i < this.length; i++) {
result.push(callback(this[i], i, this));
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment