You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set and WeakSet
Set and WeakSet are identical to Map, except for 2 major differences:
Instead of .set for values, you use .add() to create a key value pair to store.
All values in a Set must be unique and only occur once.
As far as everything else, they are very identical and are ordered.
If you need a Map-like storage or cache, but all values must be unique, then Set is perfect!
Just like WeakMap, WeakSet allows unused references to be garbage collected, and it cannot be iterated upon.
I think Set is not exactly a key-value store, but just a "value" store.
The text was updated successfully, but these errors were encountered:
I noticed this section of the book
I think Set is not exactly a key-value store, but just a "value" store.
The text was updated successfully, but these errors were encountered: