Skip to content

Instantly share code, notes, and snippets.

@arcticmouse
Created January 18, 2020 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arcticmouse/eb9d07903caf30ff7f5e205058d59677 to your computer and use it in GitHub Desktop.
Save arcticmouse/eb9d07903caf30ff7f5e205058d59677 to your computer and use it in GitHub Desktop.
techtonica challenge 1/16
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