![]() |
VOOZH | about |
The Set.size property in JavaScript returns the number of elements in a Set. In other words, we can say that this property is used to get the current size of the set. If the Set is empty the size of the set will be returned as 0.
mySet.sizeExample 1: In this example, we will see the use of the Javascript Set.size property.
Output:
Set(2) { 23, 12 }
2
Example 2: In this example, we will see the use of the Javascript Set.size property.
Output:
3