Difference between Map and Objects

Map, a collection of keyed data items, accepts any type of key, whereas an object only accepts strings and converts keys to strings.


Don't use map[key] to access entries, as it would treat the map like an object with all its limitations. Always use .set(), .get()

Biggest benefit of a Map is that we can use Object as keys.

Why would you use an Object as a key in a map?
Object, like DOM element, and you want to associate data with it, without modifying the data directly.