title: JavaScript hashmap equivalent
body: <p>As made clear in update 3 on <a href="https://stackoverflow.com/questions/367440/javascript-associative-array-without-tostring-etc#367454">this answer</a>, this notation:</p>
  <pre><code>var hash = {};
  hash[X]
  </code></pre>
  <p>does not actually hash the object <code>X</code>; it actually just converts <code>X</code> to a string (via <code>.toString()</code> if it's an object, or some other built-in conversions for various primitive types) and then looks that string up, without hashing it, in &quot;<code>hash</code>&quot;. Object equality is also not checked - if two different objects have the same string conversion, they will just overwrite each other.</p>
  <p>Given this - are there any efficient implementations of hashmaps in JavaScript?</p>
  <p>(For example, the second Google result of <a href="http://www.google.com/search?rlz=1C1GGLS_en-USUS299US303&amp;sourceid=chrome&amp;ie=UTF-8&amp;q=javascript%20hashmap" rel="noreferrer"><code>javascript hashmap</code></a> yields an implementation which is O(n) for any operation. Various other results ignore the fact that different objects with equivalent string representations overwrite each other.</p>