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.prototype.toString.call(WeakMap.prototype); // "[object Object]"
WeakMap.prototype.constructor
WeakMap
function by default.WeakMap.prototype.delete(key)
key
. WeakMap.prototype.has(key)
will return false
afterwards.WeakMap.prototype.get(key)
key
, or undefined
if there is none.WeakMap.prototype.has(key)
key
in the WeakMap
object or not.WeakMap.prototype.set(key, value)
key
in the WeakMap
object. Returns the WeakMap
object.WeakMap.prototype.clear()
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. |
ECMAScript Latest Draft (ECMA-262) The definition of 'WeakMap.prototype' in that specification. | Living Standard |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 36 | Yes | 6 | 11 | 23 | 8 |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | 36 | 36 | Yes | 6 | 11 | 23 | 8 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap/prototype