title: Run a loop n times
body: <p>I'm writing a program that will calculate a number entered by the user multiplied by 2.</p>
  
  <p>I realised I need a for loop so that the Value will increment by 1 and multiple by 2</p>
  
  <p>The problem is I want to know how to run this loop <strong>only 10 times</strong>
  - at the current moment it will run for ever and I had to place an if statement to break out of the loop if the value reaches 50.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//prompt user to enter number
  let value = prompt("Enter A number");
  //user entered number will loop through while output will show multiples //of 2
  for (value;; value++) {
    value2 = value * 2;
    document.write(`${value} multiply 2 -&gt; ${value2}`);
    document.write('&lt;br&gt;');
    //i placed this if statement to break out of the for loop as it //will run forever
    if (value &gt; 50) {
      break;
    }
  }</code></pre>
  </div>
  </div>
  </p>