WeakMap.prototype.has()
WeakMap 实例的 has() 方法返回一个布尔值,指示该 WeakMap 中是否存在具有指定键的元素。
¥The has() method of WeakMap instances returns a boolean indicating whether an
element with the specified key exists in this WeakMap or not.
Try it
语法
参数
返回值
¥Return value
如果 WeakMap 对象中存在具有指定键的元素,则返回 true;否则 false。如果 key 不是对象或 未注册符号,则始终返回 false。
¥Returns true if an element with the specified key exists in the WeakMap object; otherwise false. Always returns false if key is not an object or a non-registered symbol.
示例
使用 has 方法
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-weakmap.prototype.has |
浏览器兼容性
BCD tables only load in the browser