title: javascript for loop inside a function then output it to the page
body: <p>Here is my code. I am expecting "the number is 1, the number is 2..." to be out putted up to 5 but all that is outputted is the number is 0 not sure why.</p>
  
  <pre><code>&lt;script&gt;
  var i=0;
  function test(){
  
  for(i=0;i&lt;=5;i++){
      return "the number is" + i;
  }
  }
  &lt;/script&gt;
  &lt;script&gt;
  document.write(test());
  &lt;/script&gt;
  </code></pre>