(function(){
---this code at here ----
})();
Run Code Online (Sandbox Code Playgroud)
什么(function(){})();意思?请向我解释一下.
它创建一个匿名函数并执行它.您可以使用它来防止变量违反全局范围.
(function(){
var test = "Hello";
})();
alert(test); //test will be undefined here
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
727 次 |
| 最近记录: |