This is a new technology, part of the ECMAScript 2015 (ES6) standard .
This technology's specification has been finalized, but check the compatibility table for usage and implementation status in various browsers.

The WeakMap.prototype property represents the prototype for the WeakMap constructor.

Property attributes of WeakMap.prototype
Writable no
Enumerable no
Configurable no


WeakMap instances inherit from WeakMap.prototype. You can use the constructor's prototype object to add properties or methods to all WeakMap instances.

WeakMap.prototype is itself just an ordinary object:; // "[object Object]"


Returns the function that created an instance's prototype. This is the WeakMap function by default.


Removes any value associated to the key. WeakMap.prototype.has(key) will return false afterwards.
Returns the value associated to the key, or undefined if there is none.
Returns a Boolean asserting whether a value has been associated to the key in the WeakMap object or not.
WeakMap.prototype.set(key, value)
Sets the value for the key in the WeakMap object. Returns the WeakMap object.
Removes all key/value pairs from the WeakMap object. Note that it is possible to implement a WeakMap-like object that has a .clear() method by encapsulating a WeakMap object that hasn't it (see example on page WeakMap)


Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'WeakMap.prototype' in that specification.
Standard Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 36 6.0 (6.0) 11 23 7.1
Ordinary object ? 40 (40) ? ? ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported 6.0 (6.0) Not supported Not supported 8
Ordinary object ? ? 40.0 (40) ? ? ?

See also

Document Tags and Contributors

Contributors to this page: fscholz, claudepache, spacetime29, realityking
Last updated by: fscholz,