javascript - Why is it loaded asynchronously when dynamically creating <script> tags to load external link JS files?
我想大声告诉你
我想大声告诉你 2017-07-05 10:49:55
0
1
915

b.js file code:
var script = document.createElement("script");
script.src = "a.js";
document.body.appendChild(script);

Why does this load the a.js file asynchronously? If the code in the b.js file has not been executed yet, but the a.js file has been loaded, should we execute the code in a.js or continue to execute b. What about the rest of the code in js?
I don’t quite understand, please give me some advice

我想大声告诉你
我想大声告诉你

reply all(1)
三叔

Execute a.js first and then continue to execute the remaining code of b.js. This is a sequential loading execution form.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template