Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
The clear()
method used to remove all elements from a WeakSet
object, but is no longer part of ECMAScript and its implementations.
Syntax
ws.clear();
Examples
Using the clear
method
var ws = new WeakSet(); ws.add(window); ws.has(window); // true ws.clear(); ws.has(window); // false
Specifications
Not part of any standard.
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
clear | Chrome No support 36 — 43 | Edge No support No | Firefox No support 34 — 46 | IE No support No | Opera No support 25 — 30 | Safari No support No | WebView Android No support 37 — 43 | Chrome Android No support 36 — 43 | Firefox Android No support 34 — 46 | Opera Android No support 25 — 30 | Safari iOS No support No | Samsung Internet Android No support 3.0 — 4.0 | nodejs No support No |
Legend
- No support
- No support
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.