Standard built-ins

WeakMap.prototype.delete()

Try the free JavaScript compiler

Remove association if present; return false when absent.

Formal Syntax & Structure

javascript syntaxjavascript
weakMap.delete(key)

Parameters & Attributes

NameTypeDescription
keyObject | nonregistered SymbolEligible weak key.

Return Value

Boolean

Whether the stated condition holds.

Working Example

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