Created
January 7, 2020 08:52
-
-
Save Pierre-M/546597a49ab46ee6964b03c3e438f93c to your computer and use it in GitHub Desktop.
Interview question by Cassidy Williams (2020-01-06 newsletter)
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.filter = function(predicate) { | |
const filteredArray = []; | |
this.forEach((el, idx) => { | |
if (predicate(el, idx, this)) { | |
filteredArray.push(el); | |
} | |
}); | |
return filteredArray; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment