Map is an object in a javascript and it holds the key-value pairs in it. We can declare a map object by just writing --->
const map1 = new Map();
The key is always to be unique on a map. Or we can say it is unique in a map collection.
the first letter of the Map is always in capital letters. Let us illustrate with the help of the source code given below.
const map1 = new Map();
// set is used for pushing the key-value in a map.
map1.set('a',1);
map1.set('b',2);
map1.set('c',3);
map1.set('d',4);
// We will get the values of the key with the help of get(key); .
console.log(map1.get('b')); // 2
//Used for finding the size of the map object
console.log(map1.size); // 4
// let us remove one key-value pair from a map
map1.delete('a');
console.log(map1.size); // 3