...

/

New Built-in Classes: Map

New Built-in Classes: Map

Learn about the basics of the JavaScript’s new built-in class, maps.

Using Map

Associative maps or dictionaries are significant data structures in programming. You may have used Map in Java or Dictionary in C#, for example. Suppose you want to keep track of teams and scores during the sports season.

Why were maps introduced in JavaScript?

A map will make it easy to create and update the score values and also to look up the scores based on a team’s name. It’s hard to believe that we can seriously program without maps.

Since an object in JavaScript has keys and values and there was no special Map type, programmers often used simple objects ...