Created
October 30, 2018 12:16
-
-
Save Zielak/88018b992f1638c2f5be0e71c2607241 to your computer and use it in GitHub Desktop.
but string doesn't have `map` method... hold my beer
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
String.prototype.map = function(predicate) { | |
const arr = [] | |
for (var i = 0; i < this.length; i++) { | |
arr.push(predicate(this.charAt(i), i)) | |
} | |
return arr.join('') | |
} | |
// ᕕ( ᐛ )ᕗ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment