Created
November 14, 2018 17:09
-
-
Save fay-jai/16fc6652b90d23a440a646f5e0f72878 to your computer and use it in GitHub Desktop.
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
// Variadic sum function in JavaScript - note that we'll be using some ES6 features here | |
const sum = (...args) => { // args get collected into an array | |
return args.reduce((acc, current) => acc + current, 0); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment