Map.prototype.has() vs Map.prototype.delete()
Map.prototype.has() and Map.prototype.delete() are both JavaScript Map & Set APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. Map.prototype.has(): Checks if a key exists. Its syntax is map.has(key). Map.prototype.delete(): Removes a key-value pair. Its syntax is map.delete(key). Example of Map.prototype.has(): new Map([["a",1]]).has("a") // true. Example of Map.prototype.delete(): const m = new Map([["a",1]]); m.delete("a") // true. Read the full references for Map.prototype.has() and Map.prototype.delete() to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other Map & Set APIs worth comparing: Map.prototype.set(), Map.prototype.get(), Map.prototype.clear(), Map.prototype.size, Map.prototype.keys(), Map.prototype.values(). Both belong to the Map & Set category in the JS Reference documentation, which covers 30 entries in total. Try both in the JavaScript playground to see the behavioral difference live.