- The scope chain of JavaScript functions is defined as the scope chain and the run-time scope chain;
- When a function is defined, it has a property [[scope]] that identifies its definition scope chain, and defines the scope chain [[scope]] to abide by such rules: When a function is defined, the scope chain [[scope]] is always the execution scope chain of the external function where it resides;
- A global function defines a scope chain that contains only the properties of a window;
- A function's execution time scope chain is always defined when the head of the scope chain is pressed into the currently active object (it contains this,arguments, parameters, local variables);
- When the function executes, the variable addressing is always looked down from the top of the scope chain, so the global variable has the slowest addressing speed;
- When an internal function is executed, he is still able to access its full scope chain. This is the reason that closures can access variables defined by external functions that have ended at run time;
- When a function execution encounters a with statement, all the properties of the object specified with the WITH specification are temporarily pressed at the top of the scope chain as the topmost of the scope chain;
- When a function execution encounters a catch, it temporarily presses the catch specified Error object at the top of the scope chain as the topmost of the scope chain;
More access
JavaScript Development Advanced: Understanding JavaScript scopes and scope chains