Skip to content

Instantly share code, notes, and snippets.

@MicFin
Created May 8, 2017 18:50
Show Gist options
  • Save MicFin/90f17a46dc3aa30d4472828bc2d61b93 to your computer and use it in GitHub Desktop.
Save MicFin/90f17a46dc3aa30d4472828bc2d61b93 to your computer and use it in GitHub Desktop.
'use strict'
// Check if some of the countries have launched 20 or more rockets
// using a predicate function called isAggressive
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.some(isAggressive) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment