Why is alert (text) executed before innerHTML in this script? and how to fix it so that the alert (text) is executed later? Thank!

<script language="javascript"> text = 'text'; document.getElementById('t1').innerHTML = text; document.write(text); alert(text); </script> 
  • where does the assumption that the alert is executed earlier? - Grundy Nov.
  • The interpreter does not wait until the text appears in the DOM, but immediately executes the following code. - A. Gusev
  • alert is a modal window . This means that until it is closed, the application that generated this window will not work. - user207618

0