JavaScript · Middle · Question 59 of 75
What does typeof notDeclared return if notDeclared was never declared?
- ✓Correct answer:
"undefined"without an error - 2It throws a
ReferenceError - 3
"null"
Explanation
typeof is the only operator safe on undeclared names, which is why typeof window !== "undefined" is used to detect the browser. It still throws for let/const in the TDZ.