LearnFrenzy
Sign in Take a free test

Scope and Hoisting · Scope and Hoisting MCQ · Question 14

Hoisting of a var function expression Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 14 Back to Exercise

What is the value of save on the first line of a scope that later contains var save = function () {};?

  • A The function
  • B null
  • C undefined Correct
  • D It throws a ReferenceError
Correct Answer: Option C

Only the var declaration is hoisted. Calling save() early is therefore a TypeError (save is not a function).

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