title: Why isn't setTimeout cancelling my loop?
body: <p>I wondered how many times can a JavaScript <code>while</code> statement (in Chrome's console) can increment a variable in a millisecond, so I quickly wrote this snippet directly into console:</p>
  
  <pre><code>var run = true, i = 0;
  setTimeout(function(){ run = false; }, 1);
  while(run){ i++; }
  </code></pre>
  
  <p>The problem is that it runs forever.<br>
  Why is this happening, and how can I solve it?</p>