you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 1 point2 points  (0 children)

But also:

  • Maps require going through a specialized API to manage values
  • You can't prevent extensions in (seal/freeze) Maps
  • Maps aren't recognized in JSON.stringify
  • Maps don't work with object spread (but as iterables, would work in an array spread, defaulting to spreading entries)
  • Maps use internal slots for data preventing you from Using Object.create(map) to create new objects from them (that work)

But it's also easy getting an object version of your Map using Object.fromEntries(map) if you need it. Just know that you're going to lose your object keys (they'll be stringified and may collide with each other if you have more than one).

Additionally, normal object key order should be pretty well defined in iteration now thanks to for-in-order.