此段代码实现了在if语句中实现块级作用域
if(true){
(function (){
var a = 1;
})();
}
console.log(a);// a is not defined
此段代码实现了在if语句中实现块级作用域
if(true){
(function (){
var a = 1;
})();
}
console.log(a);// a is not defined
转载于:https://my.oschina.net/u/3787168/blog/1631735