JavaScript Set size Tutorial

In this section, we will learn what the Set size property is and how to use in JavaScript.

JavaScript Set size Property

The `size` property is used to get the number of elements already in the target Set object

Also, this method is read-only;

JavaScript Set size property Syntax:

set.size;

Example: using Set size property in JavaScript

const collect = new Set();

collect.add("Jack");

collect.add("Jack");

collect.add("Omid");

collect.add("John");

console.log(collect.size);

Output:

3
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies