Skip to content

Instantly share code, notes, and snippets.

@Chuloo
Created January 27, 2019 23:04
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 Chuloo/1060aad132280d8d09ed366123edfb1c to your computer and use it in GitHub Desktop.
Save Chuloo/1060aad132280d8d09ed366123edfb1c to your computer and use it in GitHub Desktop.
Filter numbers greater than 5
// We have an array with numbers
const numbers = [2, 4, 6, 8, 32, 100]
// Create function to filter any array
const functionToFilterNumbers = function(number){
return number > 5;
}
// Filter the 'numbers' array
const filtered = numbers.filter(functionToFilterNumbers)
//Display filtered array
console.log(filtered)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment