Why alert() dialog shows first regardless of order in the code?

后端 未结 3 1779
感动是毒
感动是毒 2020-12-12 02:34

In the code sample below, I expect the text in div to change first.

But the text changes only after I click ok in the alert dialog.

3条回答
  •  不知归路
    2020-12-12 03:01

    Modern browsers are set up such that once they encounter alert() browser will essentially pause the rendering of HTML until the alert() is done.

提交回复
热议问题