I load my Javascript from CDN using code below:
function LoadScript(href, integrity) {
var script = document.createElement("script");
script.type = 'text/javascript';
script.src = href;
script.async = false;
if (integrity) {
script.integrity = integrity;
script.crossOrigin = "anonymous";
script.referrerPolicy = "no-referrer";
}
//document.currentScript.after(script);
document.head.appendChild(script);
}
Regardless of where I invoke and place those JS files, they are always executed after static JS files which are already present in the HTML.