Getting the number of elements of a map
suggest changeTo get the number of elements in a Map, use the .size property. It is read-only. In non-strict code an assignment is ignored; in strict mode, including modules, it throws a TypeError.
const map = new Map([[1, 2], [3, 4]]);
console.log(map.size); // 2
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents