add up any number of parameters


/ Published in: JavaScript
Save to your folder(s)

just testing snipplr.com


Copy this code and paste it in your HTML
  1. function sum() {
  2. var res = 0;
  3. for (var i=0; i < arguments.length; i++) {
  4. res += arguments[i];
  5. }
  6. return res;
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.