Problem with setTimeout()
<p>This is my code. What I want it to do is write 0, wait one sec, write 1, wait one sec, write 2, wait one sec, etc. Instead it writes 5 5 5 5 5</p>

<pre><code>for(i = 0; i &lt; 5; i++) {
    setTimeout("document.write(i + ' ')", 1000);
}
</code></pre>

<p><a href="http://jsfiddle.net/Xb7Eb/" rel="nofollow">http://jsfiddle.net/Xb7Eb/</a></p>
