Question 12
Back to Exercise
What does [...{ a: 1, b: 2 }] do?
- A Returns [1, 2]
- B Throws a TypeError: object is not iterable Correct
- C Returns ["a", "b"]
- D Returns [{ a: 1, b: 2 }]
Correct Answer: Option B
Array spread uses the iteration protocol. Use Object.values(obj) or Object.keys(obj) first.
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!