What's the output?
const set = new Set([1, 1, 2, 3, 4]);
console.log(set);You missed this one before
The Set object is a collection of unique values: a value can only occur once in a set.
We passed the iterable [1, 1, 2, 3, 4] with a duplicate value 1. Since we cannot have two of the same values in a set, one of them is removed. This results in {1, 2, 3, 4}.
Question 56 · see the original (opens in a new tab)
or press Enter