Sets, WeakSets, Maps and WeakMaps
Learn how to store unique values in sets and much more.
We'll cover the following...
We'll cover the following...
What is a Set? #
A Set is an Object where we can store unique values of any type.
As you can see, at the end we tried to add “Dad” again at line 17, but the Set still remained the same because a Set can only take unique values.
Let’s continue using the same Set and see what methods we can use on it.
As you can see, a Set has a size property and we can delete an item from it or use clear to delete all the items from it.
We can also notice that a Set does not ...