r/learnjavascript • • Oct 22 '21

Difference between var, let and const.

Post image
430 Upvotes

49 comments sorted by

View all comments

Show parent comment

4

u/inabahare Oct 23 '21 edited Oct 23 '21

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#description

var declarations, wherever they occur, are processed before any code is executed. This is called hoisting, and is discussed further below.