The following four data structures are new in ECMAScript 6: Map
, WeakMap
, Set
and WeakSet
.
The WeakSet object lets you store weakly held objects in a collection.
WeakSets have only three methods, all of them work the same as the Set methods.
WeakSet.prototype.add(value)
WeakSet.prototype.has(value)
WeakSet.prototype.delete(value)
WeakSet
collection can‘t be iterated and we cannot determine its size.