Question 10
Back to Exercise
Which properties does { ...obj } copy?
- A All properties including inherited ones
- B Only string-keyed properties defined with defineProperty
- C Own enumerable properties (string and symbol keys) Correct
- D Own properties, including non-enumerable ones
Correct Answer: Option C
Inherited properties (such as methods on a class prototype) and non-enumerable properties are not copied – which is why a spread class instance loses its 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!