JS Built-ins
← Map23 / 55
Maphasbeginner

Map has() β€” after delete

πŸ“– Usage Example
const m = new Map([['a', 1]])
m.has('a')   // β†’ true
m.has('z')   // β†’ false

Use Map.has() to check whether a key exists in the map.

Map.prototype.has()

After deleting a key, has() returns false.

Challenge: Verify that has() returns false after delete().

πŸ’‘ Hints (1)
  • β€’ delete() removes the key; subsequent has() returns false