JavaScript- episode - precompiled

Precompiled

Precompiled process occurs immediately before the execution of the function

Precompiled tetralogy

1, AO create objects
2, and find the parameter variable declaration, the variable parameter name and the property name as the object AO, is undefined;
. 3, the formal and actual parameters unity
4 to find the function body function declaration , the value of the function imparting member

Beep beep Mile Mile from crossing a JavaScript educational video
https://www.bilibili.com/video/av64563473?p=11
from 52 points looks

 // 预编译过程发生在函数执行的前一刻
    // 编译四部曲
    // 1,创建AO对象
    // 2,找形参和变量声明,将变量和形参名作为AO对象的属性名, 值为undefined;
    // 3,将形参和实参相统一
    // 4,在函数体里面找函数声明,值赋予函数体

    function test(a) {
      console.log(a);
      var a = 123;
      console.log(a);
      function a() {};
      console.log(a);
      var b = function () {};
      console.log(b);
      function d() {};
    }
    test(10);

Output

Generally simple process (write very briefly) recommended to look at the video

Guess you like

Origin www.cnblogs.com/yohe/p/12461708.html