QuestenaUn entraînement qui indique quoi revoir ensuite
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.detailsBonne réponse
  4. It becomes inherited from the source object

Explication

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.

Continuer avec ce test

Commencer l’entraînement
Question 71: A source object has a nested details object. After an… · JavaScript Fundamentals · Questena