Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters -Ray

Tell us what’s happening:
My main issue is why the intended solution uses the reduce() function when the curriculum hasn’t introduced that yet. I also don’t know why my code doesn’t work but my main issue is with the curriculum.

  **Your code so far**

const sum = (...args) => {
let x=0;
for (let i=0; i < args.length; i++)
{x=+ args[i];}
return x;
}
  **Your browser information:**

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

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

As to your code not working, this line:

x=+ args[i];

specifically, what is the =+ operator?

As to reducer?

Yeah, first of all, those hints aren’t always well maintained. Also it may have been written when the curricula were organized differently.

But if you think there should be another example, you can discuss it the contributors group.

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