function evenNumberFilter(number) {
return number %2 == 0
}
function oddNumberFilter(number) {
return !evenNumberFilter(number)
}
function filter(predicate) {
const result = []
for(number=0; number<10; number++) {
if (predicate(number)) {
result.push(number)
}
}
return result
}
filter(evenNumberFilter); //[0,2,4,6,8]
filter(oddNumberFilter); //[1,3,5,7,9]