Created
July 17, 2018 13:43
-
-
Save adamgiese/fddfd05dcecc48246ec20011ef5fd610 to your computer and use it in GitHub Desktop.
Declarative Arrays: Naming Callbacks
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 newEngland = [0,3,6,19,6]; | |
const atlanta = [0,21,7,0,0]; | |
const toScore = (accumulator, value) => accumulator + value; | |
const atlantaScore = atlanta.reduce((accumulator, value) => accumulator + value); | |
const newEnglandScore = newEngland.reduce(toScore); | |
console.log(Math.max(newEnglandScore, atlantaScore)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment