QuestenaPractice that shows what to review next
Question 71

A source object has a nested details object. After an object-spread copy is made, which statement describes copy.details?

  1. It is omitted because spread copies only primitive values
  2. It is a recursively cloned object with no shared references
  3. It refers to the same nested object as source.detailsCorrect answer
  4. It becomes inherited from the source object

Explanation

Object spread copies enumerable own properties only one level deep, so the nested details value remains the same object reference. Calling this a recursive deep copy is the tempting mistake; later sources can also replace an earlier same-named property during spreading.

Continue with this test

Start practice
Question 71: A source object has a nested details object. After an… · JavaScript Fundamentals · Questena