alert(foo) //ReferenceError: foo is not defined
alert(window.foo) //undefined
Because of foo === window.foo
, I think alert(foo)
should have the same behavior as window.foo
.
what's the difference between foo
and window.foo
?
what happened when alert(foo)
?
tks