Standard built-ins

Map.prototype.delete()

Try the free JavaScript compiler

Remove a key and return whether an entry existed.

Formal Syntax & Structure

javascript syntaxjavascript
map.delete(key)

Parameters & Attributes

NameTypeDescription
keyAnyMap key; object keys use identity.

Return Value

Boolean

Whether the stated condition holds.

Working Example

Example Snippetjavascript
const m=new Map([["a",1]]);console.log(m.delete("a"),m.delete("a"));
JavaScript Reference