Challenge: Remove items from a set in ES6

Tell us what’s happening:
So the ES6 Set functionality doesn’t seem to be working like it was in the previous challenge, and just adding them individually doesn’t seem to be supported either. In fact, instead of being recognized as a built in it seems to think I’m trying to create a new Object that I’m calling a Set(). Not sure how to move past this… I tried switching browsers.

  **Your code so far**

function checkSet(){
// Only change code below this line
var set1 = new Set([1,2,3,4,5]);
// Only change code above this line
return set1;   

  **Your browser information:**

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

Challenge: Remove items from a set in ES6

Link to the challenge:

your code passed FCC test when I ran it. I believe a set, just like an array, is also a typeof object in JS. Just found out that to console.log the content of the set, we have to use the spread operator. Mimicking the example, for this particular we can do:

console.log( [...checkSet()] )

What problems are you seeing? The code you shared here passes the test, but is there something about it that confuses you?

When I tried to run it, it didn’t pass the test and the console.log(checkSet()) was showing curly braces with nothing in-between. It’s probably just something to do with my laptop/browser…

okay, now it’s passing…

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