Which came first, the chicken or the egg



The compiler attacks again

  • The compilation phase executes the declaration first, and the assignment is performed during the execution phase





  • Function declarations are promoted, but function expressions are not



Function is preferred

  • In JavaScript, duplicate declarations are ignored.
  • Function declarations have precedence over variable declarations

summary