模块化加载
require
- 首先从理解层面来介绍require能带来的好处
正常编写
缺点:污染全局作用域,依赖关系不明显
index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="a.js"></script>
</head>
<body>
<span>body</span>
</body>
</html>
function fun1(){
alert("it works");
}
fun1();
(function(){