WeakSet.prototype.clear()

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

BCD tables only load in the browser

See also