<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
// function fn(){
// console.log(1);
// }
//匿名函数。
// (function (){
// console.log(1);
// })
//调用方法:
//1.直接调用
(function (){
console.log(1);
})();
//2.绑定事件
document.onclick = function () {
alert(1);
}
//3.定时器
setInterval(function () {
console.log(444);
},1000);
</script>
</body>
</html>
原文:http://www.cnblogs.com/sj1988/p/6579912.html