Skip to content

Instantly share code, notes, and snippets.

@Chuloo
Created January 27, 2019 23:23
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/ec4b0ca7d0d6c11a62a7d8f8db4e0904 to your computer and use it in GitHub Desktop.
Save Chuloo/ec4b0ca7d0d6c11a62a7d8f8db4e0904 to your computer and use it in GitHub Desktop.
Filter numbers within a set range
// Create new array
const ages = [14, 12, 18, 21, 10];
// filter array for numbers in a range
const canSeeDeadpool = ages.filter(function(age){
return age >= 18;
})
// display new filtered array
console.log(canSeeDeadpool);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment