JavaScript Getting the number of elements of a Map


Example

To get the numbers of elements of a Map, use the .size property:

const map = new Map([[1, 2], [3, 4]]);
console.log(map.size); // 2