Skip to content

Instantly share code, notes, and snippets.

@ifkas
Created October 13, 2020 16:45
Show Gist options
  • 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