Question 4
Back to Exercise
JavaScript refuses to run the code below. Which statement correctly describes the problem?
function (a, b) {
return a + b;
}
console.log("ready");
- A SyntaxError: a function statement needs a name (or must be an expression, e.g. assigned or wrapped in parentheses) Correct
- B It prints ready
- C It defines an anonymous function and prints ready
- D ReferenceError
Correct Answer: Option A
"Function statements require a function name". Name it, assign it (const add = function (a, b) {…}) or wrap it in parentheses to make an expression.
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!