The WeakSet
.prototype
property represents the prototype for the WeakSet
constructor.
Property attributes of WeakSet.prototype |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Description
WeakSet
instances inherit from WeakSet.prototype
. You can use the constructor's prototype object to add properties or methods to all WeakSet
instances.
WeakSet.prototype
is itself just an ordinary object:
Object.prototype.toString.call(WeakSet.prototype); // "[object Object]"
Properties
WeakSet.prototype.constructor
- Returns the function that created an instance's prototype. This is the
WeakSet
function by default.
Methods
WeakSet.prototype.add(value)
- Appends a new object with the given value to the
WeakSet
object. WeakSet.prototype.delete(value)
- Removes the element associated to the
value
.WeakSet.prototype.has(value)
will returnfalse
afterwards. WeakSet.prototype.has(value)
- Returns a boolean asserting whether an element is present with the given value in the
WeakSet
object or not. WeakSet.prototype.clear()
Removes all elements from theWeakSet
object.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'WeakSet.prototype' in that specification. |
Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262) The definition of 'WeakSet.prototype' in that specification. |
Draft |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 36 | (Yes) | 34 (34) | No support | 23 | No support |
Ordinary object | ? | ? | 40 (40) | ? | ? | ? |
Feature | Chrome for Android | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | No support | No support | (Yes) | 34.0 (34) | No support | No support | No support |
Ordinary object | ? | ? | ? | 40.0 (40) | ? | ? | ? |