WeakMap
The WeakMap()
constructor creates a WeakMap
object, optionally based on a provided Array
or other iterable object.
Syntax
new WeakMap()
new WeakMap(iterable)
Note:
WeakMap()
can only be constructed withnew
. Attempting to call it withoutnew
throws aTypeError
.
Parameters
iterable
- : An
Array
or other object that implements the iterable protocol that returns an iterator object that produces a two-element array-like object whose first element is a value that will be used as aWeakMap
key and whose second element is the value to associate with that key. Each key-value pair will be added to the newWeakMap
. null is treated as undefined.
- : An