Question 3
Back to Exercise
JavaScript refuses to run the code below. Which statement correctly describes the problem?
function makeTicker() {
let count = 0;
return { count++ };
}
- A SyntaxError: { count++ } is an object literal and needs key: value pairs – return a function such as { tick: () => count++ } Correct
- B It returns 0
- C It returns { count: 1 }
- D TypeError
Correct Answer: Option A
After return, { starts an object literal; count++ is not a property definition. Expose behaviour through methods.
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!