JavaScript WeakSet

JavaScript WeakSet object is used to store only the weakly held objects.

Syntax:

new WeakSet ([iterable])

Where: iterable is the object whose elements will be added to a new WeakSet.

Note: WeakSet object can not contains the primitive type elements. It can contain only object-type elements.

JavaScript WeakSet Methods:

add() Use: To add a new object to the end of WeakSet object.

delete() Use: To delete the specified object from the WeakSet object.

has() Use: To indicate whether the WeakSet object contains the specified object element.

Please follow and like us:
Content Protection by DMCA.com