WeakMap.prototype.get()
WeakMap 实例的 get() 方法返回此 WeakMap 中的指定元素。
¥The get() method of WeakMap instances returns a specified element from this WeakMap.
Try it
语法
参数
返回值
¥Return value
与 WeakMap 对象中指定键关联的元素。如果找不到密钥,则返回 undefined。如果 key 不是对象或 未注册符号,则始终返回 undefined。
¥The element associated with the specified key in the WeakMap object. If
the key can't be found, undefined is returned. Always returns
undefined if key is not an object or a non-registered symbol.
示例
使用 get() 方法
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-weakmap.prototype.get |
浏览器兼容性
BCD tables only load in the browser