Set
Set intro
The Set object in JavaScript lets you store unique values of any type.
To append values to the Set object, use the add method passsing in the value as its argument.
To check the number of values in the set, you can use the size property.
To check if a value exists in the set, use the has method.
To remove a value from the set, use the delete method passing in the value. To delete all the
values in the set, use the clear method.
set.delete(1); // -> Returns true
set.delete(5); // -> Returns false
set.clear();
set.size; // -> Returns 0
Set and Array Conversion
Set to Array
const numArr = [1, 2];
const numSet = new Set(numArr);
// just deconstruct set
[...numSet]