Weak Set :
WeakSet objects are collections of objects. Just as with Sets,
each object in a WeakSet may occur only once; all objects in a WeakSet's collection are unique.
The main differences to the Set object are:
WeakSets are collections of objects only. They cannot contain arbitrary values of any type, as Sets can.
The WeakSet is weak, meaning references to objects in a WeakSet are held weakly.
If no other references to
an object stored in the WeakSet exist, those objects can be garbage collected.
Weak Set Methods :
WeakSet.prototype.add(value)
- Appends value to the WeakSet object.
WeakSet.prototype.delete(value)
- Removes value from the WeakSet. WeakSet.prototype.has(value) will return false afterwards.
WeakSet.prototype.has(value)
- Returns a boolean asserting whether value is present in the WeakSet object or not.