JavaScript · Junior · Question 7 of 75
What does this code print?
console.log(y);
let y = 5;- ✓Correct answer:
ReferenceError - 2
undefined - 3
5
Explanation
let and const are hoisted too, but until the declaration line they're in the temporal dead zone (TDZ): any access throws a ReferenceError. This helps catch variables used before initialization.