Standard built-ins
WeakMap
Weak-key association: objects and eligible nonregistered symbols may be keys. Values can be arbitrary. No size or enumeration; collection timing is unspecified.
Formal Syntax & Structure
javascript syntaxjavascript
new WeakMap([iterable])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterable | Iterable | Optional initial elements or entries. |
Return Value
WeakMap
New weak map.
Working Example
Example Snippetjavascript
const k={};console.log(new WeakMap([[k,4]]).get(k));