Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function declarations attached to block scope? #126

Open
ivanbacher opened this issue Nov 20, 2017 · 1 comment
Open

Function declarations attached to block scope? #126

ivanbacher opened this issue Nov 20, 2017 · 1 comment

Comments

@ivanbacher
Copy link

Say we have the following code:

{
    function aa() {
    
    }
  
    var zz;
}

function bb() {

}

which produces the following scope tree:

0: GlobalScope
1: BlockScope
2: FunctionScope
3: FunctionScope

However, if we take a look at the variables array from the global scope object:

screen shot 2017-11-20 at 16 20 38

we can see that only two variables belong to the global scope, zz and bb. Should aa not also belong to the global scope as it gets hoisted?

@0xdevalias
Copy link

Potentially related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants