LearnFrenzy
Sign in Take a free test

Scope and Hoisting · Scope and Hoisting MCQ · Question 7

A name found in no scope Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links