Created
October 4, 2023 05:29
-
-
Save HashirHussain/18e0ef21711814f39e357be8ebd9ef36 to your computer and use it in GitHub Desktop.
Array.prototype.map clone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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