Baseline Widely available
The delete()
method of Map
instances removes the specified element from this map by key.
const map1 = new Map();
map1.set("bar", "foo");
console.log(map1.delete("bar"));
// Expected result: true
// True indicates successful removal
console.log(map1.has("bar"));
// Expected result: false
Syntax Parameters
key
The key of the element to remove from the Map
object.
true
if an element in the Map
object existed and has been removed, or false
if the element does not exist.
const myMap = new Map();
myMap.set("bar", "foo");
console.log(myMap.delete("bar")); // Returns true. Successfully removed.
console.log(myMap.has("bar")); // Returns false. The "bar" element is no longer present.
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4