.size

The property of the Set collection, contains the number of values in the collection.

Time to read: less than 5 min

Briefly

The size property contains the number of values in the Set collection. It is read-only.

Example

        
          
          const watchList = new Set()console.log(watchList.size)// 0watchList.add('Fight Club')console.log(watchList.size)// 1
          const watchList = new Set()

console.log(watchList.size)
// 0

watchList.add('Fight Club')
console.log(watchList.size)
// 1