JS Built-ins
← Map24 / 55
Maphasintermediate

Map has() β€” object key

πŸ“– 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()

has() checks object keys by reference.

Challenge: Verify that has() returns true only for the same object reference.

πŸ’‘ Hints (1)
  • β€’ Map uses SameValueZero; NaN equals NaN, objects compared by reference