Standard built-ins
WeakMap.prototype.get()
Retrieve value for key or undefined; invalid primitive keys also yield undefined.
Formal Syntax & Structure
javascript syntaxjavascript
weakMap.get(key)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | Object | nonregistered Symbol | Eligible weak key. |
Return Value
Any
Associated value or undefined.
Working Example
Example Snippetjavascript
const k={};console.log(new WeakMap([[k,5]]).get(k));