JS Built-ins
← Set17 / 85
Sethasbeginner

Set has() β€” missing value

πŸ“– Usage Example
const s = new Set([1, 2, 3])
s.has(2)   // β†’ true
s.has(99)  // β†’ false

Use Set.has() to check if a value exists in the set.

Set.prototype.has()

has() returns false for a value not in the Set.

Challenge: Verify that has() returns false for a missing value.

πŸ’‘ Hints (1)
  • β€’ has() returns false (not undefined) for missing values