Last active
February 12, 2020 08:54
-
-
Save sanishkr/f5ed51a37b18d30b710660c013aaeb05 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
if(!Array.prototype.filter){ | |
Array.prototype.filter = (fn) => { | |
let res = [] | |
let length = this.length | |
for(let i=0; i < length; i++) { | |
if(fn(this[i])) { | |
res.push(this[i]) | |
} | |
} | |
return res; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment