Horje
How to Create an Empty Set in JavaScript ?

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);

Output

Set(0) {}



Reffered: https://www.geeksforgeeks.org


JavaScript

Related
What is Array.prototype.slice() method in JavaScript ? What is Array.prototype.slice() method in JavaScript ?
How to Append Header to a HTML Table in JavaScript ? How to Append Header to a HTML Table in JavaScript ?
Add Characters to a String in JavaScript Add Characters to a String in JavaScript
Split a String into an Array of Words in JavaScript Split a String into an Array of Words in JavaScript
What is a Set in JavaScript? What is a Set in JavaScript?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
10