JS Built-ins
← Map25 / 55
Maphasbeginner

Map has() β€” after set

πŸ“– 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 calling set(), has() returns true for that key.

Challenge: Verify that has() returns true immediately after set().

πŸ’‘ Hints (1)
  • β€’ has() checks for key existence, not value truthiness