Summary
The WeakSet.prototype property represents the prototype for the WeakSet constructor.
| 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
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”.
See also