Help with ES6: Rest Parameters

Tell us what’s happening:
I am passing all the checks except “The sum function should use the … rest parameter on the args parameter.” I’m not sure what this is referring to, my code seems to be working as it should. Can I get a hint?

Thank you!

Your code so far

const sum = (...num) => {
  return num.reduce((a, b) => a + b, 0);
console.log(sum(1, 2, 3)); // 6

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

Your syntax is correct, but the test is expecting that num is instead named args

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.