1. Direct reference in the page
The code copy is as follows:
<script src="a.js"><//script>
<script src="b.js"><//script>
2. Dynamically write to the page
The code copy is as follows:
document.write('<script src="a.js"><//script>')
document.write('<script src="b.js"><//script>')
3. Simulate contains functions
The code copy is as follows:
function include(path){
var a=document.createElement("script");
a.type = "text/javascript";
a.src=path;
var head=document.getElementsByTagName("head")[0];
head.appendChild(a);
}
include("a.js")
include("b.js")
4.js modular programming
Methods of require.js