Javascript Map size

Introduction

The Javascript Map size accessor property returns the number of key-value pairs in a Map object.

We can not change this property.

var myMap = new Map();
console.log(myMap.size);//from   w  w w  . j  a  v a  2  s  .c  om
myMap.set('a', 'alpha');
console.log(myMap.size);
myMap.set('b', 'beta');
console.log(myMap.size);
myMap.set('g', 'gamma');
console.log(myMap.size);



PreviousNext

Related