Imagine you record every Codémon you encounter in the tall grass inside an array.
Because you run into the same species multiple times, your array fills up with duplicates—so checking .length doesn't tell you how many different Codémon you've discovered:
↗️
Loading editor...
↶
↷
There were 5 encounters, but only 3 unique Codémon ("Zap", "Aquachu", and "Pyrochu").
To keep only unique values, JavaScript gives you a Set. When you pass an array to new Set(array), all duplicate values are automatically removed:
↗️
Loading editor...
↶
↷
Notice that a Set uses .size (not .length) to tell you how many unique items it contains!