title: Javascript associative array modification during for loop
body: <p>The javascript <code>for</code> keyword will iterate over all properties of an object.  If the object is modified within the loop body, what happens?</p>
  
  <p>For example, is the following code OK?</p>
  
  <pre><code>for(var key in obj)
      if (whatever(obj[key]))
          delete obj[key];
  </code></pre>
  
  <p>OK would be if this code works in a deterministic fashion and preferably that all keys in <code>obj</code> are tested exactly once.  By contrast, in .NET or Java similar constructs will typically throw an exception.</p>