Use the Rest Parameter with Function Parameters Challenge

Not sure what I’m doing wrong here?


const sum = (...x) => {
const args = [...x];
return x.reduce((a, b) => a + b, 0);
}

console.log(sum(10, 10, 10))

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

Worked it out just needed to remove this >

const args = [...x];

It doesn’t need that, as I can refer directly to the function name rather than defining it.

Take a look at this

function howMany(...args) {

You need to use the agrs here
and then return them
the rest parameter is used to store x y z

1 Like