concept WeakSet in category javascript
appears as: WeakSet, A WeakSet

This is an excerpt from Manning's book Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond.
A WeakSet is a specialized type of Set. Its sole purpose is to contain objects weakly in the sense that it doesn’t prevent them from being garbage-collected. Normally if you add an object to an array and remove all other references to it, it will still not be eligible for garbage collection because the array still has a reference to the object. This is the same for sets as well. Sometimes you may want to store an object without preventing it from being garbage-collected, though.