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.
I've tired something like:
let i = 0;
while (i < 20000) {
i++;
console.log(i);
}
But incrementing within the loop is not useful because the program will print all the values. Example output:
1
2
3
...
20000
I don't need all these values. I just need the final value, in this case, 20000.
Is there no way to ONLY print the number of times it runs instead of incrementing every single time it runs??