函数1:varfoo=1;functionfnz(){console.log(foo);//undefinedfoo=3;varfoo=2;console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
varfoo=1;functionfnz(){console.log(foo);//undefinedfoo=3;varfoo=2;console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
functionfnz(){console.log(foo);//undefinedfoo=3;varfoo=2;console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
console.log(foo);//undefinedfoo=3;varfoo=2;console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
foo=3;varfoo=2;console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
varfoo=2;console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
console.log(foo);//2};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
};fnz();console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
console.log(foo);//1函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
函数2:varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
varfoo=1;(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
(function(foo){console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
console.log(foo);//1foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
foo=3;varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
varfoo=2;console.log(foo);//2})(foo);console.log(foo);//1
console.log(foo);//2})(foo);console.log(foo);//1
})(foo);console.log(foo);//1
console.log(foo);//1
一只名叫tom的猫
相关分类