function func1(a, b, c) {
console.log(arguments[0]);
// expected output: 1
console.log(arguments[1]);
// expected output: 2
console.log(arguments[2]);
// expected output: 3
}
func1(1, 2, 3);
> 1
> 2
> 3
function arrgu() {
var sum = 0;
for (var i in arguments) {
sum = sum + arguments[i];
}
document.write(sum);
}
arrgu(10, 20, 30, 40);
arrgu(20, 40, 60);
>100
>120