by jaredmcateer · 12y ago · 0 comments
* they have a length
* their keys are typed, not limited to strings. Objects as keys actually works
* they can be cleared in a single call
* they can easily be iterated over keys, values or (key, value) pairs
m = new Map([[new String(1), 1]])
> Map { "1": 1 }
m.get("1")
> undefinedThe fact that, up to ES5, there's been no agreement on which name to use for the equality function and no default implementation for it it's of no excuse to avoid the issue. It's their (the people who standardized it) Map type, and they should've been able to make it as useful as possible.
> forEach calls callbackfn once for each key/value pair present in the map object, in key insertion order.
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ma...