Last active
August 29, 2015 14:20
-
-
Save adamjgrant/3097e2404c47b70daaa8 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() { | |
return [].reduce.call(arguments, function(a, b) { | |
return a + b; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Calling
sum()
with as many parameters as you like, will add them up.For example,
sum(1, 2, 3, 4)
will return10
.