Standard built-ins
WeakMap.prototype.has()
Check whether a key is registered without enumerating other keys.
Formal Syntax & Structure
javascript syntaxjavascript
weakMap.has(key)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | Object | nonregistered Symbol | Eligible weak key. |
Return Value
Boolean
Whether the stated condition holds.
Working Example
Example Snippetjavascript
const k={};console.log(new WeakMap([[k,0]]).has(k));