JavaScript Set Methods

The new Set() Method

Pass an array to the new Set() constructor:

Example

// Create a Set
const letters = new Set(["a","b","c"]);

The add() Method

Example

letters.add("d");
letters.add("e");

If you add equal elements, only the first will be saved : Continue reading JavaScript Set Methods