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!