QuizNot attempted
TDZ
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Line 2 (ReferenceError: TDZ)
typeofon a name that was never declared is safe and gives'undefined', butlaterIS declared:letbindings are hoisted and uninitialized until the declaration runs (the TDZ), so eventypeof laterthrows ReferenceError.- Not line 1: undeclared names are the one case typeof protects.
- Not both: line 1 never throws.
- Not neither: TDZ access throws even through typeof.