Javascript Set size

Introduction

The Javascript Set size returns the number of elements in a Set object.

Using size

var mySet = new Set();
mySet.add(1);/*w  w  w . j  a  v a2 s. co  m*/
mySet.add(5);
mySet.add('some text')

console.log(mySet.size); // 3



PreviousNext

Related