Standard built-ins

WeakMap.prototype.get()

Try the free JavaScript compiler

Retrieve value for key or undefined; invalid primitive keys also yield undefined.

Formal Syntax & Structure

javascript syntaxjavascript
weakMap.get(key)

Parameters & Attributes

NameTypeDescription
keyObject | nonregistered SymbolEligible weak key.

Return Value

Any

Associated value or undefined.

Working Example

Example Snippetjavascript
const k={};console.log(new WeakMap([[k,5]]).get(k));
JavaScript Reference