What is the output?
let a = 1;
{
console.log(typeof a);
let a = 2;
}
- Error
- number
- undefined
- 2
The inner
Play Problem Solving ▸
let a shadows the outer one for the whole block, and reading it before its declaration is a ReferenceError (temporal dead zone).