Why does ss()
have different answers, doesn't the function execute in where it was defined?
var scope="global";
function t(){
console.log(scope);
function ss()
{
console.log(scope);
}
var scope="local";
ss();
}
t();
ss();
It logs:
undefined
local
undefined