Standard built-ins

WeakMap.prototype.has()

Try the free JavaScript compiler

Check whether a key is registered without enumerating other keys.

Formal Syntax & Structure

javascript syntaxjavascript
weakMap.has(key)

Parameters & Attributes

NameTypeDescription
keyObject | nonregistered SymbolEligible weak key.

Return Value

Boolean

Whether the stated condition holds.

Working Example

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