Joel's dev blog

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.

Written by Joel Mun. Joel likes Typescript, React, Node.js, GoLang, Python, Wasm and more. He also loves to enlarge the boundaries of his knowledge, mainly by reading books and watching lectures on Youtube. Guitar and piano are necessities at his home.

© Joel Mun 2023