DEV Community

Discussion on: Coding Concepts - Hoisting

Collapse
 
jamesthomson profile image
James Thomson

The main reason for this is because let and const are block scoped. var on the other hand is not and therefore can be hoisted up to the global context (as long as 'use strict' is not present).

Collapse
 
chris_bertrand profile image
Chris Bertrand

Indeed, thanks for the added clarification James. I'll add that in. I'll blockquote you! 😊