Help with: Use Spread and Notes for ES5 Set() Integration

Tell us what’s happening:
Hello I´m stuck with this code, would appreciate some help. Thanks!
Your code so far


function checkSet(set){
// Only change code below this line
var checkSet(set) = checkSet(new Set([1,2,3,4,5,6,7]));
// Only change code above this line
}
 **Your browser information:**

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

Challenge: Use Spread and Notes for ES5 Set() Integration

Link to the challenge:

HI @andy7jacobs !

Your function is not returning anything.
You don’t need to create a new variable.

FCC instructions:
It should return an array containing the values of the Set.

I would look to the second line of the FCC example code they gave you and it will show you how to use the spread operator with set.

That is what you are supposed to return.

Hope that helps!

1 Like

Hi again, thanks for the reply.

I think I´m still missing something, here´s my code

function checkSet(set){

   // Only change code below this line

var setToArr = [...new Set(1,2,3,4,5,6,7)]

console.log(setToArr)

return checkSet(new Set)

   // Only change code above this line

}

I promise that you do not need to create a new variable.
You also do not need to hardcode these value here.

What if I wanted to call the function with different values than the test case like this
checkSet(new Set([16,35,79,100]))

Your function should be able to accommodate a hundred different function calls with different values and still return the right answer.
So that is why it is not a good idea to hardcode these values.

You also do not need to call the function inside itself.

Your task is to return the spread operator on the set object that is being passed in the function.
This is the set object
set

Your answer only needs to be one line :grinning:

I hope that makes more sense now.

1 Like

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