title: Why am I seeing inconsistent JavaScript logic behavior looping with an alert() vs. without it?
body: <p>I have code similar to this filtering entries in an Array of Objects:</p>
  
  <pre><code>var filterRegex = new RegExp(".*blah.*","ig");
  if (filterRegex.test(events[i].thing) &amp;&amp; events[i].show) {
      console.log("SUCCESS: filtering thing " + i + " " + events[i].thing);
      events[i].show = false;
      numevents--;
  }
  </code></pre>
  
  <p>I get inconsistent results with this if condition (checking with Firebug, both conditions are true individually, but <em>sometimes</em> the whole expression evaluates to false). HOWEVER, if I actually put an <code>alert()</code> called inside this if statement (like line 4), it becomes consistent and I get the result I want.</p>
  
  <p>Can you see anything wrong with this logic and tell me why it's not always producing what is expected?</p>