// Practice Set · JS Sets · guest

Guest practice: this set is not saved and does not count.

Question 1 of 5 from: JS Sets

What does this log?

const s = new Set([2, "2", 2, { a: 1 }, { a: 1 }, NaN, NaN, NaN]);
console.log(s.size);
Question 2 of 5 from: JS Set Methods

A Set has map, filter and sort methods, just like an array.

Question 3 of 5 from: JS Set Logic

What does this log?

const a = new Set([1, 2, 3]);
const b = new Set([3, 4]);
console.log([...a.symmetricDifference(b)]);
Question 4 of 5 from: JS Set WeakSet

What does this log?

const ws = new WeakSet();
const o = {};
ws.add(o);
console.log(ws.has(o), ws.has({}), ws.size);
Question 5 of 5 from: JS Set WeakSet

A regular Set keeps an object in memory even after the variable that referred to it is set to null, but a WeakSet does not.

Ready to submit?

Click a question to go back and check it. After you submit, you will see the right answer and an explanation for every question. As a guest, nothing is saved.