Some notes on javascript the core

Some notes on reading an article:  javascript the core

Execution context(EC)
VO
Variable Object (VO): includes variables and function declarations.              function expression will not be included in the VO
Activation Object (AO): include VO + function arguments
In ES5, the VO and AO is combined into the lexical environments.
Scope Chain
before we go to the __parent__ (upper context), first __proto__ chain is considered
Closure : Scope chain = Activation object + [[Scope]]
This Value
The value of this is determinate only once when entering the context.

Hoist

What really happen for hoist is: when execution engine is preparing the ‘execution context’ for the current function call, it will make global-context + this + outer-ev + local-vars ready. So it will scan the function body first and try to find out the variable and function declarations and prepare memory placeholders for them. After that it would start executing(interpreting) the function line by line. As a result, it makes the illusion that all the variables are ‘Hoisted’ to the top.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s