// Map doesn't do what we want.let map =mapmapsize // 1map // falsemap // undefined// ValueMap to the rescue!let map =mapmapsize // 1map // truemap // "Treasure"
ValueMap and ValueSet compute hash values for objects and their properties such that property enumeration order doesn't affect the hash value. This means the computed hash values do not depend on the property insertion order or other property ordering schemes. This is accomplished in time linear in the number of properties, i.e. without sorting the properties. See the comments relating to the hash function in the source code for details.