Question · JavaScript and TypeScript course · Module 3: Classes and OOP

Advantages of Map over Object

What is the main advantage of Map over a plain object ({}) as a key-value collection?

Answer options

  • Map is faster than an object in all operations
  • Map allows any key type (not just string/symbol)
  • Map uses less memory than an object
  • Map automatically sorts keys alphabetically

You can check the correct answer by solving this task in the CodeWorlds game.