LearnFrenzy
Sign in Take a free test

Spread and Rest Operators · Spread and Rest MCQ · Question 10

What object spread copies Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links