====================================================================== https://javascript.info/script-async-defer ---------------------------------------------------------------------- script.async = false; ---------------------------------------------------------------------- Dynamic scripts We can also add a script dynamically using JavaScript: let script = document.createElement('script'); script.src = "/article/script-async-defer/long.js"; document.body.append(script); // (*) The script starts loading as soon as it’s appended to the document (*). Dynamic scripts behave as “async” by default. That is: They don’t wait for anything, nothing waits for them. The script that loads first – runs first (“load-first” order). let script = document.createElement('script'); script.src = "/article/script-async-defer/long.js"; script.async = false; document.body.append(script); For example, here we add two scripts. Without script.async=false they would execute in load-first order (the small.js probably first). But with that flag the order is “as in the document”: ======================================================================