Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The WeakMap() constructor creates WeakMap objects.
Note: WeakMap() can only be constructed with new. Attempting to call it without new throws a TypeError.
An Array or other iterable 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.
| ECMAScript® 2027 Language Specification # sec-weakmap-constructor |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 19, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.