LearnFrenzy
Sign in Take a free test

Arrow Functions · Arrow Functions MCQ · Question 8

Are arrow functions hoisted? Answer, explanation & discussion

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

What happens when greet() is called on the line before const greet = () => "hi";?

  • A It returns "hi"
  • B ReferenceError – const greet is in its temporal dead zone Correct
  • C It returns undefined
  • D TypeError: greet is not a function
Correct Answer: Option B

An arrow is an expression; only the variable is hoisted. With var the call would be a TypeError (greet is undefined).

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