Understanding Hoisting in JavaScript in Javascript


Variable and function declarations are moved to the top of their containing scope during compilation.

Source Code

console.log(hoistedVar); // undefined
var hoistedVar = 5;
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments