Useful features of Map collections

Map collections have a number of useful properties and methods. Let's take a look at them.

Collection size

The size property contains the size of the collection:

console.log(map.size);

Checking for a key presence

You can check if a key exists in a collection using the has method:

console.log(map.has(arr1));

Deletion by key

You can delete an element from a collection using the delete method:

map.delete(arr1);

Clearing a collection

You can clear an entire collection using the clear method:

map.clear();
enru