Algorithms and Data Structures · Junior · Question 15 of 75

When is a Map a better choice than a plain object for a dictionary?

Explanation

Map accepts keys of any type (objects, numbers), keeps insertion order, has size and is optimized for frequent additions and deletions. A plain object converts keys to strings and inherits keys from its prototype.

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 15

Test yourself

Take the Algorithms and Data Structures · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz