Skip to content

Instantly share code, notes, and snippets.

@dottedsquirrel
Created August 30, 2019 01:49
Show Gist options
  • Save dottedsquirrel/aac6aa6fab848e096e6744e584c74c80 to your computer and use it in GitHub Desktop.
Save dottedsquirrel/aac6aa6fab848e096e6744e584c74c80 to your computer and use it in GitHub Desktop.
JavaScript array method every()
let animals = [
{name: 'Tibbers', type: 'cat', isNeutered: true, age: 2},
{name: 'Fluffball', type: 'rabbit', isNeutered: false, age: 1},
{name: 'Strawhat', type: 'cat', isNeutered: true, age: 5}
]
let allNeutered = animals.every(animal => {return animal.isNeutered});
//will return false because not all values under isNeutered evaluates to true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment