JS Built-ins
← Set18 / 85
Sethasbeginner

Set has() β€” after add

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

After add(), has() returns true for that value.

Challenge: Verify that has() returns true after add().

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