Question 7
Back to Exercise
What happens when code reads a variable that is not declared in any scope of the chain?
- A It evaluates to undefined
- B It evaluates to null
- C A ReferenceError is thrown Correct
- D A new global variable is created
Correct Answer: Option C
Reading an unresolvable name throws (typeof is the exception). Assigning to one creates a global in sloppy mode and throws in strict mode.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!