title: How to make code with setTimeout work correct?
body: <p>This code display 10 ten times.</p>
  
  <p>But I want to display numbers from 0 to 9.</p>
  
  <p>How can I fix this code?</p>
  
  <pre><code>for(var i = 0; i &lt; 10; i++) {
      setTimeout(function() {
        console.log(i);  
      }, 10);
  }
  </code></pre>