simple-scopes.js 264 B

123456789
  1. function foo() {
  2. function bar() {
  3. var y = 6;
  4. }
  5. bar()
  6. return y;
  7. }
  8. foo(); //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()