JS hangs on a do while loop

后端 未结 6 1532
南旧
南旧 2020-12-20 07:40

I am wondering how I can solve a hanging page with JS.

I have a JS loop which I\'m testing like this, but it seems to hang forever - is there a way to stop it hangin

6条回答
  •  余生分开走
    2020-12-20 08:42

    Javascript is single-threaded, so nothing else can happen while it's running your loop. It's running ten million times, and on each run it's setting the innerHTML of #my_data to something new. It's very inefficient and seems useless. What are you trying to accomplish?

提交回复
热议问题