Skip to main content
Version: 3.27.2

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 with new. Attempting to call it without new throws a TypeError.

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 a WeakMap key and whose second element is the value to associate with that key. Each key-value pair will be added to the new WeakMap. null is treated as undefined.