3 ms·
C++ ordered maps are in sorted order whereas php-style hashes are in insertion order (recent versions of Ruby and Python have adopted the php semantics; in JS m
by fanf2 8y ago
C++ ordered maps are in sorted order whereas php-style hashes are in insertion order (recent versions of Ruby and Python have adopted the php semantics; in JS maps are php style but JS objects are unordered)
- demurgos 8y agoSmall note, the JS objects are in fact ordered. The lack of determinism caused issues between browsers so the spec now defines the following order: 1. Integer indexes (string keys) in ascending numeric order 2. Other string keys (non-integer indexes) in insertion order 3. Symbols in insertion order https://www.ecma-international.org/ecma-262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys https://www.ecma-international.org/ecma-262/#sec-ordinary-ob...