Scope and closure (3): hoisting
March 24, 2018
⏳ 1 min read
FYI
Notes made with You don’t know JS.
Important points on hoisting
- Hoisting is just basic. Just remember hoisting happens per scope and only on variable and function declarations, not assignments or reference.
- Also remember functions are hoisted first, and then variables.
- The hoisted functions or variables will override any other functions or variables that have the same name.
- Function declarations that appear inside of normal blocks like
if
typically hoist to the enclosing (outer) scope.