How to Create an Empty Set in JavaScript ?
Last Updated :
01 Feb, 2024
In JavaScript, you can create an empty Set using the Set
constructor.
Syntax:
let emptySet = new Set();
Example: Here, new Set()
creates a new Set object, and emptySet
is assigned to that newly created Set. This Set is initially empty, with no elements in it.
Javascript
let emptySet = new Set();
console.log(emptySet);
|
Share your thoughts in the comments
Please Login to comment...