← Quiz: Classes, Modules, Map and Set: all 10 questions
Quiz: Classes, Modules, Map and Set · Question 9 of 10
When is a Map a better choice than a plain object?
When is a Map a better choice than a plain object?
- A.When you need to send the data as JSON
- B.When keys can be any type and you add and remove entries often
- C.When there are exactly two fixed keys
- D.Never; Map is deprecated
Answer & explanation
Correct answer: When keys can be any type and you add and remove entries often
Map accepts any key type, keeps insertion order and has a size property.
Can you get the rest right without peeking?
Take the timed Quiz: Classes, Modules, Map and Set quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →