javascirpt arguments object
// With Rest Parameter
let sum = (...nums) => {
let total = 0;
for (let num of nums) {
total += num;
}
return total;
};
console.log(sum(4, 23, 65, 2)); // 94
// Before
function sum() {
let total = 0;
for (let argument of arguments) {
total += argument;
}
return total;
}
console.log(sum(4, 23, 65, 2)); // 94