Return to Snippet

Revision: 32368
at September 23, 2010 05:05 by housecor


Initial Code
function addStuff() {
    var total = 0;
    for (var ii = 0; ii < arguments.length; ii++) {
        //Not only does this iterate through arguments, it uses the + to force addition instead of concatenation
        total += +arguments[ii];
    }
    return total;
}

Initial URL


Initial Description
Pass as many arguments as you wish. You can access them in the arguments array.

Initial Title
Umlimited arguments to function

Initial Tags


Initial Language
JavaScript