JulianJohannesen
JulianJohannesen

Reputation: 386

Order of precedence during JS engine compilation phase

I'm trying to understand how the order of precedence for function and variable declarations and variable assignment and function definition during the JavaScript engine's compilation phase interacts with other things that go on during the compilation phase. Please tell me if this looks right:

  1. Allocate memory and set up reference to any function identifiers
  2. Allocate memory and set up reference to any variable identifiers
  3. Assign values to variables
  4. For each function, create a new execution context and scope and add a reference to the parent scope

Upvotes: 2

Views: 84

Answers (1)

Lucifer Morningstar
Lucifer Morningstar

Reputation: 305

Just Quoting the current standard here, actual implementations may vary:

15.1.11Runtime Semantics: GlobalDeclarationInstantiation ( script, env )

Upvotes: 1

Related Questions