Created
May 8, 2017 18:50
-
-
Save MicFin/90f17a46dc3aa30d4472828bc2d61b93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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