JavaScript WeakSet

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


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 contains only object type elements.

JavaScript WeakSet Methods:

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

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

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

Content Protection by
Please Share