Last active
September 30, 2017 13:41
-
-
Save juliobetta/59c9d0d15e6d06f13b3d7d2a57efd13e to your computer and use it in GitHub Desktop.
Reduce example
This file contains 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 list = [1, 2, 3, 4, 5]; | |
const result = list.reduce((accumulator, item) => { | |
return accumulator + item; | |
}, 0); | |
console.log(result); // 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment