Created
July 17, 2018 12:59
-
-
Save adamgiese/1aa40099b6bf66c470a218a8b7af1dcc to your computer and use it in GitHub Desktop.
Declarative Arrays: Sum reducer
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
| const numbers = [1,2,3,4,5]; | |
| const sum = numbers.reduce( | |
| (accumulator, currentValue) => accumulator + currentValue | |
| ); | |
| console.log(sum); // 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment