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.
Modern browsers are set up such that once they encounter alert() browser will essentially pause the rendering of HTML until the alert() is done.
alert()