JavaScript Code

How to create an empty set in JavaScript?


Problem Statement

write a JavaScript program to create an empty set

Solution

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

new Set();

Program

1. create a new empty set vowels

const vowels = new Set();
console.log(vowels);


copyright @2022