I’m having a hard time understanding the solution of Use the Rest Parameter with Function Parameters in ES6
const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
}
console.log(sum(0,1,2))
especially this line: args.reduce((a,b) => a+b, 0);
what does it do exactly? what happen on this line?