Introduction
For our final chapter, we'll be taking a look at two more new, related types. Set
and WeakSet
, like Map
and WeakMap
, are collections of other values. However, rather than creating relationships between pairs of values, Set
and WeakSet
create a relationship between all entries in the collection. These data structures ensure that there are no duplicated entries. If a new item evaluates as equal with another member, it won't be added to the Set
.
The recipes in this chapter will illustrate how to implement different behaviors with the set classes.