JS basic grammar --- scope chain

 

To analyze the nested functions:

(Typically 5 layers Layer)

    was num = 10 ;
    function f1 () {
       were num = 20 ;
      function f2 () {
         were num = 30 ;
        function f3 () {
           were num = 50 ; 
          console.log (num); 
        } 
        F3 (); 
      } 
      F2 (); 
    } 
    F 1 ();

 

FIG appreciated facie corresponding scopes:

 

 

Guess you like

Origin www.cnblogs.com/jane-panyiyun/p/11956999.html