Skip to content

Function declarations attached to block scope? #126

@ivanbacher

Description

@ivanbacher

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions