Standard built-in objects: Set Flashcards

1
Q

Set

A

Set: Object that stores unique values, either primitive or object references.

Methods:

  • add(value): Adds value
  • delete(value): Removes value
  • has(value): Checks if value exists
  • clear(): Removes all values

Missing methods!!!

Example:

const mySet = new Set();
mySet.add(1).add(2);
mySet.has(1); // true
How well did you know this?
1
Not at all
2
3
4
5
Perfectly