Javascript - how to avoid blocking the browser while doing heavy work?
<p>I have such a function in my JS script:</p>

<pre><code>function heavyWork(){
   for (i=0; i&lt;300; i++){
        doSomethingHeavy(i);
   }
}
</code></pre>

<p>Maybe "doSomethingHeavy" is ok by itself, but repeating it 300 times causes the browser window to be stuck for a non-negligible time. In Chrome it's not that big of a problem because only one Tab is effected; but for Firefox its a complete disaster.</p>

<p>Is there any way to tell the browser/JS to "take it easy" and not block everything between calls to doSomethingHeavy?</p>
