Question 11
Back to Exercise
The code below stops with an uncaught error. Which statement correctly describes the problem?
const scores = { maths: 90, science: 85 };
const list = [...scores];
console.log(list);
- A TypeError: scores is not iterable – array spread needs an iterable; use Object.values(scores) Correct
- B It prints [ 90, 85 ]
- C It prints [ 'maths', 'science' ]
- D It prints []
Correct Answer: Option A
Spread inside [ ] uses the iteration protocol, which plain objects do not implement. ({ ...scores } is fine – object spread copies properties.)
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!