Question 8
Back to Exercise
The code below stops with an uncaught error. Which statement correctly describes the problem?
const point = { x: 3, y: 4 };
const [x, y] = point;
console.log(Math.hypot(x, y));
- A It prints 5
- B It prints NaN
- C TypeError: point is not iterable – use an object pattern: const { x, y } = point Correct
- D SyntaxError
Correct Answer: Option C
Array patterns need an iterable. Plain objects are destructured by name with { }.
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!