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

Collections · MCQQuestion link ↗

What is the size of this Set?

console.log(new Set([1, 1, 2]).size);
Choose one answer
Answer & explanation

Answer: 2

A Set stores distinct values; the repeated first number is stored once.