title: How to count how many times a while loop runs?
body: <p>So I have created a while loop that runs many times (10000-20000) before it stops. I'm trying to count exactly how many times it loops before it stops.</p>
  
  <p>I've tired something like:</p>
  
  <pre><code>let i = 0;
  
  while (i &lt; 20000) {
    i++;
    console.log(i);
  }
  </code></pre>
  
  <p>But incrementing within the loop is not useful because the program will print all the values. Example output:</p>
  
  <pre><code>1
  2
  3
  ...
  20000
  </code></pre>
  
  <p>I don't need all these values. I just need the final value, in this case, 20000.</p>
  
  <p>Is there no way to ONLY print the number of times it runs instead of incrementing every single time it runs?? </p>