Skip to content

Instantly share code, notes, and snippets.

@isacjunior
Last active August 20, 2017 00:51
Show Gist options
  • Save isacjunior/d0440454b699e51134e3db4d02131f1e to your computer and use it in GitHub Desktop.
Save isacjunior/d0440454b699e51134e3db4d02131f1e to your computer and use it in GitHub Desktop.
function filter(array, test) {
const passed = []
for (var i = 0; i < array.length; i++) {
if(test(array[i]))
passed.push(array[i])
}
return passed
}
const filterAgeEx5 = filter(users, user => user.age > 50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment