WeakMap.prototype

WeakMap.prototype

WeakMap.prototype属性表现为WeakMap的构造器。

| WeakMap.prototype属性的属性特性 |

|:----|

| Writable | no |

| Enumerable | no |

| Configurable | no |

描述

WeakMap实例从WeakMap.prototype继承了所有属性。你可以在WeakMap构造器中添加属性和方法,从而使得所有实例中都有效。

WeakMap.prototype本身只是一个普通的对象:

Object.prototype.toString.call(WeakMap.prototype // "[object Object]"

属性

WeakMap.prototype.constructor返回创建WeakMap实例的原型函数。WeakMap函数是默认的。

方法

WeakMap.prototype.delete(key)移除key的关联对象。执行后WeakMap.prototype.has(key)返回false。WeakMap.prototype.get(key)返回key关联对象, 或者undefined(没有key关联对象时)。WeakMap.prototype.has(key)根据是否有key关联对象返回一个Boolean值。

规范

SpecificationStatusComment
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'WeakMap.prototype' in that specification.StandardInitial definition.
ECMAScript Latest Draft (ECMA-262)The definition of 'WeakMap.prototype' in that specification.Living Standard

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support36(Yes)6.0 (6.0)11237.1

FeatureAndroidChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic supportNo supportNo support(Yes)6.0 (6.0)No supportNo support8