/ Published in: JavaScript
Pass as many arguments as you wish. You can access them in the arguments array.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }