Created
June 4, 2018 11:42
-
-
Save nathan-lapinski/b8a6f73c781f36ba35b36c15c1720c6e to your computer and use it in GitHub Desktop.
Implementing Filter
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(predicateFn) { | |
let retVal = []; | |
for (let i = 0; i < this.length; i++) { | |
if (predicateFn(this[i]) { | |
retVal.push(this[i]); | |
} | |
} | |
return retVal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment