title: javascript - how to use a text box input in a for loop
body: <p>I am trying to write a solution for a javascript application that takes a number input &amp; depending on that number is how many times it runs a specific function. I am using a text box for input field &amp; a button to process the number of times the user wants the function to run. It is for a game of dice game. User enters how many games he wants to play and clicks button to run the roll_dice function that many times. I'm not sure if I am going the right way with using a for loop to take users numeric input and loop through its value until it ends for example</p>
  
  <pre><code>function games() {
          var num = document.getElementById("inp").vale;
          var i;
  
          for (i = 0; i &lt; num; i++) {
              roll_dice();
          }
  }
  </code></pre>