Hoisting VI
2022年5月1日小于 1 分钟
Hoisting VI
Question
What does the code snippet to the right output by console.log
?
Snippet
var foo = 1;
(function () {
console.log(foo);
foo = 2;
console.log(window.foo);
console.log(foo);
var foo = 3;
console.log(foo);
console.log(window.foo)
})()