// 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([10, 20, 30]);
console.log(s[0], s.length, s.size);
Question 2 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.union(b)], [...a.intersection(b)]);
Question 3 of 5 from: JS Set Logic

What does this log?

const a = new Set([1, 2, 3]);
const b = new Set([2, 3, 4]);
console.log([...a.difference(b)], [...b.difference(a)]);
Question 4 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 5 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);
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.