Do you know the output of the code below:
If you are not clear about this question, please read this [url=http://davidshariff.com/blog/what-is-the-execution-context-in-javascript/]article[/url].
(function() {
console.log(typeof foo); // function pointer
console.log(typeof bar); // undefined
var foo = 'hello',
bar = function() {
return 'world';
};
function foo() {
return 'hello';
}
}());
If you are not clear about this question, please read this [url=http://davidshariff.com/blog/what-is-the-execution-context-in-javascript/]article[/url].
本文通过一个具体的JavaScript代码示例,探讨了执行上下文中变量声明与赋值的区别,以及函数声明与变量声明之间的先后顺序对代码执行的影响。文章提供了一个链接指向更详细的解释。
1275

被折叠的 条评论
为什么被折叠?



