Another new data structure introduced in ES2015 is the map. A map is essentially an enhanced object. It stores key-value pairs, just like an object. However, while an object’s key can only be a string, a map’s key can be any data type. We can use an object as a key if we like.
Again, when we insert an object as a key, only that unique object is inserted. Testing for an identical but unique object will fail.
Constructing a Map
const map = new Map();
We can pass in a series of key-value pairs to the map constructor.