"Notes" "JavaScript You Don't Know (Volume 1)" Chapter 4: Improvement

The chicken or the egg came first


The compiler strikes again

  • The declaration is executed first in the compilation phase, and the assignment is executed in the execution phase


  • Function declarations will be promoted, but function expressions will not be promoted

Function first

  • In JavaScript, repeated declarations are ignored.
  • Function declaration priority is higher than the priority of variable declaration

summary


Guess you like

Origin blog.csdn.net/sinat_41696687/article/details/114937190