Last active
February 7, 2020 16:16
-
-
Save AllGistsEqual/f1eda3aadb2020b7c850578acb0df12d to your computer and use it in GitHub Desktop.
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
function sum(...theArgs) { | |
return theArgs.reduce((previous, current) => { | |
return previous + current; | |
}); | |
} | |
console.log(sum(1, 2, 3)) // 6 | |
// expected output: 6 | |
console.log(sum(1, 2, 3, 4)) // 10 | |
// expected output: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment