$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #214

What is the output?

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