DEV Community

Discussion on: DEMYSTIFYING HOISTING IN JAVASCRIPT

Collapse
 
anjusam profile image
anjusam

'let and const (the new ways to declare variables in Javascript) do not support hoisting.' is that right?
These variables are hoisted but not assigned a value 'undefined' in the compilation phase of the execution context (unlike the var variable). These variables are initialized only in the execution phase. The time between the declaration of the variable and the initialization is called the temporal dead zone and accessing this variable in this window will throw a reference error.