summaryrefslogtreecommitdiff
path: root/Base/home/anon/Source/js/simple-scopes.js
blob: 14e6c35e75da08f0b72dc72afa1325fa07eb03c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
 //I should return `undefined` because y is bound to the inner-most enclosing function, i.e the nested one (bar()), therefore, it's undefined in the scope of foo()
function foo() {
    function bar() {
        var y = 6;
    }
    
    bar();
    return y;
}

console.log(foo());