You can tell the browser how to execute the scripts. By default, browser runs the script immediately by pausing HTML parsing. Else you can specify async or defer with the script tag to either run script asynchronously or defer it until HTML is parsed.
<script src="script.js"></script>
<script async src="script.js"></script>
<script defer src="script.js"></script>