JavaScript Map.prototype.delete() Method
JavaScript Map Instance methodThis method is supported by all modern browsers.
The delete() method removes an entry from a Map by its key.
Description
The delete() method removes the entry for a key and returns whether anything was removed.
Deleting entries while looping over a map with for...of or forEach() is safe: removed entries that haven't been visited yet are simply skipped. The size property drops by one for each entry removed.
Keys are compared with the SameValueZero algorithm: primitives by value, NaN as equal to itself, and objects only when they're the same object.
Syntax
map.delete(key)Parameters
- keyThe key to remove.
Return Value
true if an entry was removed, false if the key didn't exist.
Example
Browser Support
The following information will show you the current browser support for the Map.prototype.delete() method. Hover over a browser icon to see the version that first introduced support for this method.
This method is supported by all modern browsers.
Desktop





Tablets & Mobile






-
Supported Unknown Not supported
Sponsors
Password Manager
PasswordPal stores your passwords and private notes behind encryption that happens in your browser.
Copy Paste List
Copy and paste or download lists in your preferred format, including plain text, PDF, or HTML.
Unicode Characters & Emojis
Search all Unicode characters and emojis plus other tools.
Check Shortened URLs
Expand shortened URLs to view the destination link.
Advertise Here
Advertise your company and products here!