# WeakMap

A WeakMap object is a collection of key/value pairs in which keys must be
objects. References to key objects in a WeakMap are held weakly, meaning
they do not prevent garbage collection if there are no other references
to the object. WeakMap keys are not iterable.

### set(key, value) <sub>function</sub>

Set the value for the specified key in the WeakMap. The key must be an object.



**key**: The object key.

**value**: The value associated with the key.


**Returns**: The WeakMap object (for chaining).


### get(key) <sub>function</sub>

Return the value associated with 'key' in the WeakMap, or undefined if
no such key exists. The key must be an object.



**key**: The object key.


**Returns**: The value associated with the key, or undefined if not present.


### has(key) <sub>function</sub>

Return a boolean indicating whether an element with the specified key
exists in the WeakMap. The key must be an object.



**key**: The object key to check.


**Returns**: True if the key is found, otherwise false.


### delete(key) <sub>function</sub>

Remove the specified key and its associated value from the WeakMap,
if it exists.



**key**: The object key to remove.


**Returns**: True if an element was removed, otherwise false.

