Maps

Learn how to use a JavaScript map, a new data structure added in ES2015. Master its uses for more powerful and elegant code.

We'll cover the following...

Map

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. ...