Map.prototype.delete()
Map.prototype.delete() is a JavaScript method in the Map & Set category. Removes a key-value pair. The syntax is map.delete(key). A typical example: const m = new Map([["a",1]]); m.delete("a") // true. Its time complexity is O(1) amortized, which matters when it runs over large inputs. A close sibling is Map.prototype.set(), which sets a key-value pair in the Map. A close sibling is Map.prototype.get(), which returns the value associated with a key. A close sibling is Map.prototype.has(), which checks if a key exists. A close sibling is Map.prototype.clear(), which removes all entries. More about this category: Map and Set collection methods. Related Map & Set methods: Map.prototype.set(), Map.prototype.get(), Map.prototype.has(), Map.prototype.clear(), Map.prototype.size, Map.prototype.keys(), Map.prototype.values(), Map.prototype.entries(). This page is part of the free JS Reference documentation covering 1027+ methods, each with syntax, parameters, return values, examples, and common pitfalls. You can try Map.prototype.delete() immediately in the JavaScript playground, look up unfamiliar terms in the glossary, or return to the JS Reference homepage.