# Set

A Set object lets you store unique values of any type, whether primitive values or object references. It remembers insertion order for iteration.

### add(value) <sub>function</sub>

Add a new element with the given value to the Set, if it’s not already present.



**value**: The value to add.


**Returns**: The Set object (for chaining).


### has(value) <sub>function</sub>

Return a boolean indicating whether the Set contains the specified value.



**value**: The value to check for presence in the Set.


**Returns**: True if the value is found, otherwise false.


### delete(value) <sub>function</sub>

Remove the specified value from the Set if it exists.



**value**: The value to remove.


**Returns**: True if the value was present and removed, otherwise false.


### clear() <sub>function</sub>

Remove all elements from the Set, leaving it empty.



**Returns**: None


### size <sub>accessor</sub>

(read only)

A read-only property returning the number of elements in the Set.



**Returns**: The number of unique values in the Set.


### forEach(callbackFn, thisArg) <sub>function</sub>

Execute a provided callback function once for each value in the Set,
in insertion order.



**callbackFn**: A function(value, valueAgain, set) to execute on each element.

**thisArg**: Optional. A value to use as 'this' when executing callbackFn.


**Returns**: None


### values() <sub>function</sub>

Alias for values() in a Set. Return a new Iterator object containing all
the values (as keys) in the Set, in insertion order.



**Returns**: An iterator of the Set's values.


### keys() <sub>function</sub>

Alias for values() in a Set. Return a new Iterator object containing all
the values (as keys) in the Set, in insertion order.



**Returns**: An iterator of the Set's values.


### entries() <sub>function</sub>

Return a new Iterator object containing [value, value] pairs for each value
in the Set, in insertion order. This maintains API consistency with Map objects.



**Returns**: An iterator of [value, value] pairs.

