Skip to content

Instantly share code, notes, and snippets.

@sanishkr
Last active February 12, 2020 08:54
Show Gist options
  • Save sanishkr/f5ed51a37b18d30b710660c013aaeb05 to your computer and use it in GitHub Desktop.
Save sanishkr/f5ed51a37b18d30b710660c013aaeb05 to your computer and use it in GitHub Desktop.
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