Tell us what’s happening:
I’m putting the correct solution but its saying that I’m not?
Your code so far
const sum = (...nums) => nums.reduce((a, b) => a + b, 0);
Your browser information:
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/22.214.171.124 Safari/537.36
Challenge: ES6 - Use the Rest Parameter with Function Parameters
Link to the challenge:
The directions say to use the rest parameter on args.
You wrote nums here
It doesn’t seem like it does
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.
the paragraph before refers to the example unless its refers to both the example and my solution
Take a look at the last test case here
sum should be an arrow function which uses the rest parameter syntax (
... ) on the
It is saying to use the rest syntax on a parameter called args
That is why you are falling the test.
You are using nums as a parameter name here
The test is looking for a parameter name of args.
Once I change that in your code then it passes.
Hope that helps
Ahh, I didn’t look closely at the test cases
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.