Nice article on: JavaScript variable scope hoisting

Things to Remember

  • All declarations, both functions and variables, are hoisted to the top of the containing scope, before any part of your code is executed.
  • Functions are hoisted first, and then variables.
  • Function declarations have priority over variable declarations, but not over variable assignments.

Leave a Reply

Your email address will not be published. Required fields are marked *