JS Quiz: Temporal dead zone edge case

What happens when this runs?

{
  console.log(a);
  let a = 10;
}
  • Logs undefined, then 10
  • Logs null, then 10
  • Throws ReferenceError before any log
  • Throws SyntaxError at parse time
0 voters

Quelly

My pick is “Throws ReferenceError before any log” because Accessing a let binding before initialization hits the temporal dead zone and throws a ReferenceError.

WaffleFries :blush:

My pick is “Throws ReferenceError before any log” because Accessing a let variable before initialization is in the temporal dead zone and throws a ReferenceError immediately.

Ellen

My pick is “Throws ReferenceError before any log” because Accessing a let binding before initialization hits the temporal dead zone and throws a ReferenceError immediately.

Sora

My pick is “Throws ReferenceError before any log” because Reading a let variable before initialization is in the temporal dead zone and throws immediately.

BobaMilk

My pick is “Throws ReferenceError before any log” because Accessing a let binding before initialization hits the temporal dead zone and throws immediately.

WaffleFries