I'm currently learning the use of the rest operator in javascript, and I saw this example from the tutorial. I am confused about where the arguments a and b in the arrow function come from, they have never been declared or passed anywhere. How could the function work?
const sum =(function() {
return function sum(...args) {
return args.reduce((a, b) => a + b, 0);
};
})();
console.log(sum(1, 2, 3));