title: Loop through a 'Hashmap' in JavaScript
body: <p>I'm using <a href="http://www.mojavelinux.com/articles/javascript_hashes.html" rel="noreferrer">this</a> method to make artificial 'hashmaps' in javascript. All I am aiming for is key|value pairs, the actual run time is not important. The method below works fine. </p>
  
  <p><strong>Are there any other ways to loop through this?</strong></p>
  
  <pre><code>for (var i in a_hashMap[i]) {
      console.log('Key is: ' + i + '. Value is: ' + a_hashMap[i]);
  } 
  </code></pre>
  
  <p>I run into a problem where this outputs a bunch of undefined keys after the first key, when the array only contains one entry. I have a feeling it is because the code is within a loop which uses i, even though when I follow in debug it shouldn't be happening. I also cannot change i as the for loop seems to not understand the replaced var at all.</p>
  
  <p>Anyone any ideas?</p>