Pre-compiled JavaScript Summary

A  pre-compiled function execution occurs before the moment, to call to handle the relationship between the data,

     Divided AO (Ativation Object) and GO (Global Object).

Two  AO satisfy four steps (1) to create an object AO;

                  ( 2) find the parameter and variable declarations, as the property name and assign AO is undefined;

                  ( 3) the uniform parameter argument values;

                  ( 4) to find a function declaration in the function body, the value is assigned to the function body;

    GO satisfy three steps (AO removing the rule (3));

Three  Also in the function call data, first looking for AO, AO If you did not find GO; undeclared seen on assignment GO.

     There you have the equivalent of a safe home, a safe bank, one day you would use a ring (life events), you do not remember which put a safe (but you put these two places), you must first find in their own homes (AO), did not go to the bank to find (GO).

 eg: 

Bank function (A) { 
the console.log (A);
var A = B =. 1;
function A () {
}
the console.log (A)
}
Bank (. 1);
the console.log (B);
a Survival Song, can test the above rule, the actual development of the individual have not used, or not so named when more data with a variable name, the string is too easy to be hit, usually used to understand the process of execution of the function just fine

Guess you like

Origin www.cnblogs.com/sfun666/p/11892374.html