Skip to content

Instantly share code, notes, and snippets.

@MicFin
Created May 8, 2017 18:51
Show Gist options
  • Save MicFin/8e6146713aa1a18d76f03cbe0c838c1f to your computer and use it in GitHub Desktop.
Save MicFin/8e6146713aa1a18d76f03cbe0c838c1f to your computer and use it in GitHub Desktop.
'use strict'
// Check if every one of the countries have launched 20 or more rockets
// using a predicate function
const rockets = [
{ country: 'Russia', launches: 32 },
{ country: 'US', launches: 23 },
{ country: 'China', launches: 16 },
{ country: 'Europe(ESA)', launches: 7 },
{ country: 'India', launches: 4 },
{ country: 'Japan', launches: 3 }
]
const isAggressive = rocket => {
return rocket.launches >= 20
}
rockets.every(isAggressive) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment