JavaScript WeakMap object is used to store the elements as key-value pair where keys are weakly referenced.
Syntax:
new WeakMap([iterable])
Where: iterable is the object whose elements are in the form of key-value pair.
Note: WeakMap object can not contains the primitive type elements. It can contains only object type elements.
JavaScript WeakMap Methods:
delete()
Use: To delete the specified element from a WeakMap object.
get()
Use: To return the value of specified key.
has()
Use: To indicate whether the Weakmap object contains the specified value element.
set()
Use: To add or update the key-value pairs to WeakMap object.
Please Share