34. The function scope title

1. factorial: function recursively

 

2. Variable and function priority

         Error because the variable foo is not ()

 

 

3, an internal body of the function var a = b = 3; b = 3 corresponds to the global variables in the GO, a AO function role in the domain.

 

4 scope closure function

 

  bar () being given, because of the pre-parsing var bar undefined variable is not ()

 

var a = b = 3, if the statement in the function, a is an AO b is GO var a = 1, b = c = 0; if the body of the function, ab is a GO AO c

 

                                                                                              Only the var is declared, no var is not declared. Function is executed, the variable will not find in the body of the function is implicitly declared as a global variable pollution caused by the global variable.

5. Scope parameter in the AO

     Biography external arguments when calling

 

 Did not pass the external arguments when calling

         typeof a is undefined, undefined into boolean value is true, because the boolean undefined turn, will first turn into "undefined" string, then into boolean, because it is non-empty is true.

Because the function named fn, auto fn is the name attribute  

 

Guess you like

Origin www.cnblogs.com/yzdwd/p/12565898.html