Variables in JavaScript Are NOT Hoisted

Why are people telling us that variables become hoisted to the top of the script or code block – that simply isn’t true.

The definition of hoisting is: “raise (something) by means of ropes and pulleys”, and JavaScript hoisting is a temporal process, not a syntactic modification. I admit there’s an equivalence, in that the end result is as if the variables are syntactically hoisted to the top of the script, but why treat students like babies regarding this particular aspect of the JavaScript language?

Students are facing much bigger challenges than having to understand this two-stage temporal process – variables are 1st allocated memory, and then either initialised immediately, or during the 2nd phase… and that’s basically it. By understanding it properly, we can then appreciate the difference between how var, let, and const declared variables are being processed.