Skip to content

Instantly share code, notes, and snippets.

@juliobetta
Last active October 1, 2017 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliobetta/d99584e9d7778f3d12f60fd868f4c8d4 to your computer and use it in GitHub Desktop.
Save juliobetta/d99584e9d7778f3d12f60fd868f4c8d4 to your computer and use it in GitHub Desktop.
const hasDebutAfter1980 = character => character.debut > 1980;
const withEvery = characters.every(hasDebutAfter1980);
const withReduce = characters.reduce((accumulator, character) => {
if(hasDebutAfter1980(character)) {
return true;
}
return accumulator && hasDebutAfter1980(character);
}, false);
// true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment