DEV Community

Discussion on: Introduction to Hoisting in JavaScript.

Collapse
 
a777med profile image
a777med

What about using the let keyword or const? Do they have the same effect?

Collapse
 
uddeshjain profile image
Uddesh

using const and let will throw ReferenceError because you have to initialize the variable at the time of declaration if you wanna use const or let. It's not officially mentioned in ECMAScript documentation but it will definitely throw the error.