过时
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()
method used to remove all elements from a
WeakMap
object, but is no longer part of ECMAScript and its implementations.
wm.clear();
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
Not part of any standard.
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
clear
弃用
非标
|
Chrome 36 — 43 | Edge No | Firefox 20 — 46 | IE 11 | Opera 25 — 30 | Safari 8 — 9 | WebView Android 37 — 43 | Chrome Android 36 — 43 | Firefox Android 20 — 46 | Opera Android 25 — 30 | Safari iOS 8 — 9 | Samsung Internet Android 3.0 — 4.0 | nodejs 0.12 — 4.0.0 |
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
WeakMap
WeakMap.prototype.clear()
WeakMap.prototype.delete()
WeakMap.prototype.get()
WeakMap.prototype.has()
WeakMap.prototype.set()
Function
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()