LearnFrenzy
Sign in Take a free test

Functions · JavaScript Functions MCQ · Question 1

Which function can be called before its definition? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

Which kind of function can be called on a line before the line where it is defined?

  • A A function expression: const f = function () {};
  • B An arrow function: const f = () => {};
  • C None of these
  • D A function declaration: function f() {} Correct
Correct Answer: Option D

Declarations are hoisted with their body. For expressions and arrows only the variable is hoisted (var: undefined → TypeError when called; let/const: TDZ → ReferenceError).

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