Question 1
Back to Exercise
JavaScript refuses to run the code below. Which statement correctly describes the problem?
function track(event, ...details,) {
return `${event}: ${details.join(", ")}`;
}
console.log(track("click", "button", "home"));
- A SyntaxError: a rest parameter cannot be followed by a comma, even a trailing one Correct
- B It prints click: button, home
- C It prints click:
- D TypeError
Correct Answer: Option A
Trailing commas are allowed after normal parameters, but not after a rest parameter, because nothing may follow it.
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!