Created
May 23, 2019 05:07
-
-
Save macjabeth/a591865ee2173f99028dc6698c1f9ffa to your computer and use it in GitHub Desktop.
Examples written for my students.
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
function filter(arr, func) { | |
const res = []; | |
for (const val of arr) { | |
if (func(val)) { | |
res.push(val); | |
} | |
} | |
return res; | |
} | |
console.log(filter( | |
[2, 4, 6, 8, 10], | |
(currentValue) => { | |
return currentValue > 5; | |
} | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment