Variable Hoisting

Understand variable hoisting in JavaScript. Learn what the engine does behind the scenes to our variable and function declarations and how this results in unexpected behavior. Learn the difference between variable hoisting and function hoisting.

Variable Hoisting

What do you think the following code will log to the console? Take a guess and then run the code to check.

Get hands-on with 1000+ tech skills courses.