Map (collection)

A built-in JavaScript collection of key-value pairs where keys can be any value, including objects, kept in insertion order.

In more detail

Keys are compared by identity, so two different objects with the same contents are two keys. Map can be iterated and has a size, but it keeps its keys alive, so using DOM elements as keys can leak them.

Related terms

Taught in

References