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 return false 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 the WeakSet 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

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung InternetNode.js
Basic supportChrome Full support 36Edge Full support YesFirefox Full support 34IE No support NoOpera Full support 23Safari Full support 9WebView Android Full support 37Chrome Android Full support 36Edge Mobile Full support YesFirefox Android Full support 34Opera Android Full support 23Safari iOS Full support 9Samsung Internet Android Full support Yesnodejs Full support 0.12

Legend

Full support  
Full support
No support  
No support

See also

Document Tags and Contributors

Contributors to this page: fscholz, jameshkramer, kdex, andradei, claudepache, realityking, teoli
Last updated by: fscholz,