JavaScript Code

How to create an empty set in JavaScript?

Create an empty set in JavaScript

In this tutorial, you will learn how to write a JavaScript program to create an empty Set.


To create an empty set, use the Set() constructor, and pass no arguments to the constructor.

new Set();


1. Create a new empty set named vowels.

const vowels = new Set();

copyright @2022