$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #129

What is the output?

const s = new Set([1, '1', 1]);
console.log(s.size);
  1. 2
  2. 1
  3. 3
  4. 0
A Set compares without coercion, so 1 and '1' are different but the repeat 1 collapses.
Play Problem Solving ▸