Question 5
Back to Exercise
The code below stops with an uncaught error. Which statement correctly describes the problem?
function fetchScore(student, callback) {
const score = student.length * 10;
callback(score);
}
fetchScore("Asha");
- A TypeError: callback is not a function – fetchScore was called without one Correct
- B It returns 40
- C It prints 40
- D Nothing happens
Correct Answer: Option A
The missing argument is undefined and calling undefined throws. Pass a callback, or guard it: callback?.(score).
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!