Created
January 18, 2020 23:25
-
-
Save arcticmouse/eb9d07903caf30ff7f5e205058d59677 to your computer and use it in GitHub Desktop.
techtonica challenge 1/16
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
numbers = [1, 2, 3, 4, 5] | |
function onlyEvens(n) { | |
if(n % 2 == 0) { | |
return true | |
} | |
else { | |
return false | |
} | |
} | |
function betterFilter(arr_to_filter, functionName) { | |
var return_arr = [] | |
arr_to_filter.forEach(element => {return_arr.push(functionName(element))} ) | |
return return_arr | |
} | |
console.log(betterFilter(numbers, onlyEvens)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment