Skip to content

Instantly share code, notes, and snippets.

@ifkas
Created October 13, 2020 16:45
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 ifkas/0c25681aea5f27f87854bbf148372b22 to your computer and use it in GitHub Desktop.
Save ifkas/0c25681aea5f27f87854bbf148372b22 to your computer and use it in GitHub Desktop.
Reduce - exercise 1
let apples = shelf.reduce((accumulator, number) => {
if(number.includes("apple")) {
return accumulator += 1;
} else {
return accumulator;}
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment