function sum() {
var args = sum.arguments;
var n = args.length;
var i = 0, t = 0;
for (i = 0; i < n; i++) {
t += args[i];
}
return t;
}
alert(sum(1,2,3,4,5,6));// return 1+2+3+4+5+6 = 21
Title:
Javascript - Get arguments
Description:
function sum() { var args = sum.arguments; var n = args.length; var i = 0, t = 0; for (i = 0; i < n; i++) { t += args[i]...
...
Rating:
4