我知道了‘函数声明和变量声明总是被JavaScript解释器隐形地移动(“提升”)到其包含范围的顶部。’-- JavaScript Scoping and Hoisting。
但是哪一个先吊起来了呢?
由于在SegmentFault有人问我,我应该给他一个确切的答案。
发布于 2017-01-06 17:37:53
function test() {
return foo;
var foo = true;
function foo(){}
}
console.log(typeof test()) // function函数首先被提升为See here for more informations
https://stackoverflow.com/questions/41502711
复制相似问题