PRACTICE / UNDERSTAND / REPEAT
JavaScript practice question
Practice collections with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
1 questionAnswers explainedFree · no login
Try this question
What is the size of this Set?
console.log(new Set([1, 1, 2]).size);
Answer & explanation
Answer: 2
A Set stores distinct values; the repeated first number is stored once.