I dont understand why this test is failing: sum should be an arrow function which uses the rest parameter syntax (...) on the args parameter.
THE TASK - Modify the function sum using the rest parameter in such a way that the function sum is able to take any number of arguments and return their sum.
const sum = (...q) => {
return q.reduce((a, b) => a + b, 0);
}
console.log(sum(2, 3, 4, 5, 6));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0
Challenge: ES6 - Use the Rest Parameter with Function Parameters