ES6 - Collections Map Property Size


Advertisements


This property returns the number of key/value pairs in the Map object.

Syntax

Map.size

Example

var myMap = new Map(); 
myMap.set("J", "john"); 
myMap.set("M", "mary"); 
myMap.set("T", "tom");
  
console.log(myMap.size);

Output

3

es6_collections.htm

Advertisements