Hello, what could be wrong with my code because it’s failing this test
sum
should be an arrow function which uses the rest parameter syntax (...
) on the args
parameter.
Your code so far
const sum = (...k) => {
let total = 0;
for (let i = 0; i < k.length; i++) {
total += k[i];
}
return total;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0
Challenge Information:
ES6 - Use the Rest Parameter with Function Parameters