title: how to remove key+value from hash in javascript
body: <p>Given</p>
  
  <pre><code>var myHash = new Array();
  myHash['key1'] = { Name: 'Object 1' };
  myHash['key2'] = { Name: 'Object 2' };
  myHash['key3'] = { Name: 'Object 3' };
  </code></pre>
  
  <p>How do I remove <code>key2</code>, and <code>object 2</code> from the hash, so that it ends up in a state as if I did:</p>
  
  <pre><code>var myHash = new Array();
  myHash['key1'] = { Name: 'Object 1' };
  myHash['key3'] = { Name: 'Object 3' };
  </code></pre>
  
  <p>delete doesn't do what I want;</p>
  
  <pre><code>delete myHash['key2'] 
  </code></pre>
  
  <p>simply gives me this:</p>
  
  <pre><code>var myHash = new Array();
  myHash['key1'] = { Name: 'Object 1' };
  myhash['key2'] = null;
  myHash['key3'] = { Name: 'Object 3' };
  </code></pre>
  
  <p>the only docs I can find on <code>splice</code> and <code>slice</code> deal with integer indexers, which I don't have.</p>
  
  <p>Edit: I also do not know that 'key2' is necessarily in position [1]</p>
  
  <p><b>UPDATE</b></p>
  
  <p>OK slight red herring, delete does seem to do what I want on the surface, however, I'm using json2.js to stringify my object to json for pushing back to the server,</p>
  
  <p>after I've deleted, myHash gets serialized as:</p>
  
  <pre><code>[ { Name: 'Object 1' }, null, { Name: 'Object 3' } ]
  </code></pre>
  
  <p>Is this a bug in json2.js? or is it something I'm doing wrong with delete?</p>
  
  <p>Thanks</p>