WeakMap.prototype.clear()

这篇翻译不完整。请帮忙从英语翻译这篇文章

已废弃
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.

clear()用来从 WeakMap对象中移除所有元素。但不再是ECMAScript和它的实现部分

Syntax

wm.clear();

Examples

使用 clear 方法

var wm = new WeakMap();
var obj = {};

wm.set(obj, "foo");
wm.set(window, "bar");

wm.has(obj); // true
wm.has(window); // true

wm.clear();

wm.has(obj)  // false
wm.has(window)  // false

Specifications

Not part of any current specification or draft. This method was part of the ECMAScript 6 draft specification until revision 28 (version of October 14, 2014), but has been removed in later versions of the draft. It will not be part of the final standard.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 36 未实现 [1] 11 23 7.1
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 [1] 未实现 未实现 8

[1] The clear() method has been supported from version 20 until version 45 (including).

See also

文档标签和贡献者

 此页面的贡献者: xdsnet
 最后编辑者: xdsnet,