js point in this issue? (Normal function)

 

A, this point:

  ①

  

    This is this is just an ordinary function, then this is not call any event, this point is the window object.

  ②

  

    When this outer layer of the package, this layer tightened his object, this can be seen when printing is zero, this is fun, and when the print is. 3, this point is a.

  ③

  

    In this case, the external b no impact on the internal, always print b 1,

  ④

  

    In this case, the first statement b mode to let, let us all know as a new way ES6 proposed statement, he can not be declared, but only under a scope, it is not being given at this time , fun.a () this is the fun itself, so the printing of 3, this C is performed (at) for the window, the print undefined;

  Note: When this itself in window, this ** are undefined ;

Two, this point of change;

  

  

  

Guess you like

Origin www.cnblogs.com/flower-y/p/11440011.html