Reputation: 13
Because I am not using the var keyword why is the variable 'local' not in the global scope in the chrome console?
function test(){
local = true;
};
console.log(local);//Uncaught ReferenceError: local is not defined
Upvotes: 0
Views: 118
Reputation: 881
It is simply because the test function is never called so the local variable is never created due to which it throws error
Upvotes: 4