Created
May 8, 2017 18:51
-
-
Save MicFin/8e6146713aa1a18d76f03cbe0c838c1f 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 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