A Map stores associations between keys and values, making it useful for dictionary-style lookups. In JavaScript, the built-in Map collection avoids pitfalls that make plain objects unreliable as maps. section 9.2 section 9.4
Why plain objects can fail as maps:
- Objects inherit properties such as constructor, so a missing dictionary entry can return an inherited property instead of undefined. section 9.2.1
- Object keys are strings: using different HTML elements as keys can convert them to the same string and overwrite an association. section 9.2.1
Translations and DOM data
A localization dictionary can associate phrases with translations. A Map is also a better fit than a plain object for attaching data to HTML elements; Maps can be iterated with for...of. section 9.2 section 9.2.1 section 9.4









































