这篇翻译不完整。请帮忙从英语翻译这篇文章。
该特性处于 ECMAScript 6 规范草案中,目前的实现在未来可能会发生微调,请谨慎使用。
Summary
The WeakSet
.prototype
property represents the prototype for the WeakSet
constructor.
WeakSet.prototype 属性的属性特性: |
|
---|---|
writable | false |
enumerable | false |
configurable | false |
Description
WeakSet
instances inherit from WeakSet.prototype
. You can use the constructor's prototype object to add properties or methods to all WeakSet
instances.
Properties
WeakSet.prototype.constructor
- 返回构造函数即
WeakSet
本身.
Methods
WeakSet.prototype.add(value)
- 在该
WeakSet
对象中添加一个新元素value
. WeakSet.prototype.clear()
- 清空该
WeakSet
对象中的所有元素. WeakSet.prototype.delete(value)
- 从该
WeakSet
对象中删除value
这个元素, 之后WeakSet.prototype.has(value)
方法便会返回false
. WeakSet.prototype.has(value)
- 返回一个布尔值, 表示给定的值
value
是否存在于这个WeakSet
中.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 6 (ECMA-262) WeakSet.prototype |
Release Candidate | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 未实现 bug 792439 | 未实现 | 未实现 | 未实现 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 未实现 | 未实现 bug 792439 | 未实现 | 未实现 | 未实现 |
Chrome-specific notes
- This feature is available behind a preference. In
chrome://flags
, activate the entry “Enable Experimental JavaScript”.