In Javascript, when you write a piece of code like the one below, it seems like the computer will first complete the entire loop 100 000 times (which can take a second or two) and THEN dump all 100 000 lines in the console in one shot. How can I make it so that the computer will update the console one line at a time, with each pass thru the loop?
To clarify, I would like to, in effect, be able to see what the computer is doing AS it is doing it, and not once it has finished doing it.
for (var i = 1; i <= 100000; i++) {
console.log(i);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…