Problem Statement
Which statement is correct regarding hoisting and the temporal dead zone (TDZ)?
Explanation
All declarations are hoisted. var is initialized to undefined, while let/const exist in the TDZ until their declaration is evaluated, preventing access before initialization.
Code Solution
SolutionRead Only
// console.log(a); // undefined (var) // console.log(b); // ReferenceError (TDZ) var a = 1; let b = 2; const c = 3;
Practice Sets
This question appears in the following practice sets:
