WeakSet
WeakSet is a built-in collection in JavaScript that stores object references with weak memory semantics. It is designed to track object presence without preventing garbage collection. Only objects can be added to a WeakSet; attempting to add a non-object value results in a TypeError. The set itself does not expose its elements, and elements are not enumerable.
The core operations of a WeakSet are add, has, and delete. However, it has important limitations: there
In practice, WeakSet is often used to track metadata or associations for objects without preventing their disposal.
Relation to other structures: a WeakSet stores only object references and does not offer iteration, unlike