Favorites

JavaScript Map.prototype.delete() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Map.prototype.delete()
JavaScript Map Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

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

const m = new Map([['a', 1], ['b', 2]]);
console.log(m.delete('a'), m.delete('z'));
console.log(m);

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

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee