Which fix removes the bug?
const set = new Set([1, 2, 3]); console.log(set.length);
- Read the count with
set.sizeinstead - Read the count with
set.countinstead - Convert with
Array(set).lengthfirst - Call
set.values().lengthto count it
A Set exposes size; length is undefined on it.
Play Problem Solving ▸