Pre-analytic function supplement

Pre-analysis:

  1. All variable declarations, will be raised to the very top, but not improve assignment

  2. All function declarations, will be raised to the very top, but will not improve the calling function

  3. If there is a plurality of identical variable declarations var while the latter will be ignored var

  4. If there is a function of the same name at the same time, the latter function will overwrite the previous functions

  5. If the function of the same name and variable declaration statements, function declarations will override the variable declaration

  6. Lexical analysis Step 3:

    1. Analysis of the first function parameter (the default is undefined), and then analyzed assignment parameter (parameter not directly ignore this step)

    2. Analysis of all the variables declared in the function body:

      2.1 If the parameter variable name and the names are the same, ignore var;

      2.2 If the parameter name and the variable name is not the same, equivalent declare a variable, such as var foo, is undefined;

    3. Analysis of all functions declared in the function body,

      3.1 If the same function names and variable names, function as the overall value of the variable;

      3.2 If the function names and variable names are not the same, corresponding to the function name var function name = function () {};

    Function is being executed is divided into two steps:

    1. Lexical analysis process;

    2. Implementation process

Guess you like

Origin www.cnblogs.com/hhmmpp/p/10993007.html