STEP 1
A shallow copy duplicates only the outer object; nested objects are still shared.
Reference Semantics
Memory, Pointers & Allocation
Sharing mutable data accidentally is a common source of production bugs, especially once work becomes concurrent.
STEP 1
A shallow copy duplicates only the outer object; nested objects are still shared.
STEP 2
A deep copy duplicates the nested data you plan to mutate.
STEP 3
Choose copy versus share deliberately: copying protects isolation, while sharing can be useful when it is immutable.
Nested objects need independent nested copies
Why is `{ ...original }` not enough for nested data?
Next: Phase 2 Hands-On Drill
Solve the coding challenge in the in-browser IDE with live visible and hidden specification tests.