Do you have a suggestion that you could quote to help with the context?
Javascript is compiled in a browser (it is sent to the browser as a simple source). But it only compiles as it loads. Therefore, if you have a script tag followed by a div tag, followed by a script tag, it will load these things sequentially. The browser will stop loading the entire page (it still loads resources, it just does not load HTML) until your script has been loaded (this is because the script may have a document.write document).
<script> var someVariable = 'hello world'; alert(document.getElementById('someid')); </script> <div id='someid'></div> <script> alert(document.getElementById('someid')); </script>
source share