How to output to console in real time in Javascript?

后端 未结 5 918
南方客
南方客 2020-12-20 09:40

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 tw

5条回答
  •  离开以前
    2020-12-20 10:22

    Your statement is not valid. JavaScript handles the for loop synchronously.

    Please check the following question: JavaScript, Node.js: is Array.forEach asynchronous?

提交回复
热议问题