Open Genzhen opened 3 years ago
function test() { console.log("out"); } (function () { if (false) { function test() { console.log("in"); } } test(); })();
每日一题会在下午四点在交流群集中讨论,五点小程序中更新答案 欢迎大家在下方发表自己的优质见解 二维码加载失败可点击 小程序二维码
test is not a function
立即执行函数 内部定义的变量不会和外部的变量发生冲突,俗称“匿名包裹器”或“命名空间”
立即执行函数内部声明test,会存在变量提升。
扫描下方二维码,收藏关注,及时获取答案以及详细解析,同时可解锁800+道前端面试题。