@DasSurma (wonder if you might wanna help answer this question) Why did TC39 decide to not give new Map() indexes? https://stackoverflow.com/questions/37822141/how-do-you-get-the-key-at-specifc-index-in-javascript-map-object … Right now we have to loop through the Map to get the index of a key.
-
-
Maps (and sets) are indeed unordered. If the order matters, use an array instead.
2 replies 0 retweets 0 likes -
I believe ES sets and maps are ordered in insertion order. It's not explicitly specified, but the specification device uses a List which implies an ordering.
2 replies 0 retweets 2 likes -
If ordering matters, then maps or sets are conceptually the wrong data structure. My mental model is that maps contain a pile of key/value pairs, and sets contain a pile of values. This is also why maps/sets get a `size` rather than a `length`. Length implies an inherent order.
3 replies 0 retweets 0 likes -
While this may be true in general of maps/sets, it's not right for JS Maps/Sets. They work great when ordering matters. And the mental model should be an ordered list of pairs, not a pile.
2 replies 0 retweets 4 likes -
Interesting. Something we should be more explicit/vocal about imo. When I hear Set/Map, I don’t assume ordering.
2 replies 0 retweets 1 like
Agree. The spec is arguably misleading too when it says "Map object must be implemented using either hash tables or other mechanisms that" since types explicitly called hash tables are not ordered IME.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.