It’s called JavaScript but it’s not a scripting language. Every line is read ahead of time and the executable is built just like Java or C. Hoisting as a concept causes more confusion than helps, like there is some software crane that hoists functions and vars to the top. Why can’t we just say the whole file is read ahead of time, functions are resolved and there are weird rules you have to learn about global vars assignments.