title: Printing out for loop upon user input
body: <p>I'm having issues with displaying my for loop on my page. There is a button which upon the click prompts the user to enter a number then display the iterations of said number through a for loop. I've looked at similar questions that have been asked on here but seem to still be running into a problem.</p>
  
  <pre><code>&lt;!doctype hmtl&gt;  
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  
  &lt;button onclick="getNumber()"&gt;Click!&lt;/button&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;script&gt;
  function getNumber() {
      var i;
      var num;
      var n = prompt("Please enter a number");
      for(i = 0; i &lt; n.length; i++){
          num += n[i];
  
          document.getElementById("demo").innerHTML += num + " ";  
      }
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>