It looks like this:
The <script> tag is very convenient, as long as you add a web page, the browser will read and run it. However, it has some serious flaws.
var script = document.createElement(“script”);
script.src = url;
Here is a simple example based on ScriptJunkie ‘s article to illustrate the basic usage of these two libraries. For more advanced usage, please refer to their documentation.
Below, use LABjs to rewrite it:
Next is the rewrite of requireJS:
If loading in order is important to you, you can use the official order plugin .