JavaScript – Create an Empty Set
To create an empty Set in JavaScript, create a new set using new Set()
and pass no arguments to the constructor. The new Set()
creates and returns an empty Set.
Syntax
The syntax to create an empty Set using Set() constructor is
new Set()
ADVERTISEMENT
Examples
In the following example, we create an empty set using Set() constructor.
index.html
Conclusion
In this JavaScript Tutorial, we learned how to create an empty Set in JavaScript using Set() constructor, with examples.