From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../global_objects/weakmap/has/index.html | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/weakmap/has/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/weakmap/has/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/weakmap/has/index.html b/files/zh-cn/web/javascript/reference/global_objects/weakmap/has/index.html new file mode 100644 index 0000000000..2c411d429d --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/weakmap/has/index.html @@ -0,0 +1,123 @@ +--- +title: WeakMap.prototype.has() +slug: Web/JavaScript/Reference/Global_Objects/WeakMap/has +translation_of: Web/JavaScript/Reference/Global_Objects/WeakMap/has +--- +
{{JSRef}}
+ +

 has() 方法根据WeakMap对象的元素中是否存在key键返回一个boolean值。

+ +

语法

+ +
wm.has(key);
+ +

Parameters

+ +
+
key
+
必须的。用来检测WeakMap对象中是否存在元素的键为key。
+
+ +

Return value

+ +
+
Boolean
+
如果指定的key存在于某个元素中则返回true,否则返回flase。
+
+ +

例子

+ +

使用 has方法

+ +
var wm = new WeakMap();
+wm.set(window, "foo");
+
+wm.has(window); // returns true
+wm.has("baz");  // returns false
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES6', '#sec-weakmap.prototype.has', 'WeakMap.prototype.has')}}{{Spec2('ES6')}}Initial definition.
{{SpecName('ESDraft', '#sec-weakmap.prototype.has', 'WeakMap.prototype.has')}}{{Spec2('ESDraft')}} 
+ +

浏览器兼容

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support36{{CompatGeckoDesktop("6.0")}}11237.1
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatNo}}{{CompatGeckoMobile("6.0")}}{{CompatNo}}{{CompatNo}}8
+
+ +

Firefox-特有说明

+ + + +

See also

+ + -- cgit v1.2.3-54-g00ecf