is there a way to access a non-global shadowed variable in javascript

Viewed 182

I'm currently learning javascript scope and was just wondering whether it is possible to access a non-global shadowed variable in javascript? i.e. in the example below, the variable a that equal to 10 in the aFunc function

var a = 1;
function aFunc(){
    var a = 10;
    function innerFunc(){
        var a = 100;
        console.log("innerFunc a = " + a);
        console.log("is it possible to access outer function's a variable?");
        console.log("global a = " + window.a);
    }
    innerFunc();
}
aFunc();

ps - I understand naming your variables with the same name is very bad practice, but I guess I asked this question out of curiosity

1 Answers
Related