$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · medium · #124

Which fix removes the bug?

const set = new Set([1, 2, 3]);
console.log(set.length);
  1. Read the count with set.size instead
  2. Read the count with set.count instead
  3. Convert with Array(set).length first
  4. Call set.values().length to count it
A Set exposes size; length is undefined on it.
Play Problem Solving ▸