JavaScript WeakSet : Object
WeakSets are a collection of Objects where each object can only appear once in the set
similar to Set. Unlike Set, WeakSet does not allow iterating over its values. If WeakSet would
be the only object holding on to the value, the value will be released from memory. The values stored in WeakSet
cannot be primitive values (Boolean, Number, String, or undefined).
Instance Methods
Stores value
in this
. If value
is already stored, there is no change to
the WeakSet. Returns this
.
Example:
RunResults:
Removes value
from this
. Returns true
if value
was in
this
before deleting it.
Example:
RunResults:
Copyright © PUBLIC Contributors