Skip to content

Instantly share code, notes, and snippets.

@ptzn
Created December 25, 2009 18:07
Show Gist options
  • Save ptzn/263690 to your computer and use it in GitHub Desktop.
Save ptzn/263690 to your computer and use it in GitHub Desktop.
function sum() {
var sum = 0;
for( var i =0; i < arguments.length; i++ ) {
sum += arguments[i];
}
return sum;
}
sum(1,2,3,4,5); // -> 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment