Hint
arguments is only available in regular functions. Rest params (...args) work everywhere and are the modern replacement.
function sum() {
return Array.from(arguments).reduce((a, b) => a + b, 0);
}
const sumRest = (...args) => args.reduce((a, b) => a + b, 0);
console.log(sum(1, 2, 3, 4));
console.log(sumRest(1, 2, 3, 4));10 10
Explanation: arguments is available in regular functions (not arrows). Rest params (...args) work in both and are more explicit. Both produce the same sum.
Key Insight: arguments is only available in regular functions. Rest params (...args) work everywhere and are the modern replacement.