Skip to content

Instantly share code, notes, and snippets.

@juliobetta
Last active December 9, 2020 01:55
Show Gist options
  • Save juliobetta/cec9fe8b5c1289896484e3c5fd41d85e to your computer and use it in GitHub Desktop.
Save juliobetta/cec9fe8b5c1289896484e3c5fd41d85e to your computer and use it in GitHub Desktop.
const filtered = characters.filter(character => character.debut < 1990);
const reduced = characters.reduce((accumulator, character) => {
if(character.debut < 1990) {
return [...accumulator, character];
}
return accumulator;
}, []);
// [
// { "name": "Donkey Kong", "debut": 1981 },
// { "name": "Link", "debut": 1986 }
// ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment