Created
May 20, 2019 13:56
-
-
Save iamads/c962e7368935ac8ca6ab1fe97a9ab0d9 to your computer and use it in GitHub Desktop.
myFilter
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
const myFilter = (array, callback) => { | |
const newArray = []; | |
array.forEach(element => { | |
if (callback(element)) { | |
newArray.push(element) | |
} | |
}) | |
return newArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment