Hint
Shallow copies references; deep copies recursively
Shallow copy: top-level properties only ā nested objects are still shared references. Deep copy: recursively copies everything.
const orig = { a: 1, nested: { b: 2 } };
// Shallow ā spread, Object.assign
const shallow = { ...orig };
shallow.nested.b = 99;
console.log(orig.nested.b); // 99 ā orig mutated!
// Deep copy
const deep = structuredClone(orig); // ā
modern recommended
// JSON.parse(JSON.stringify()) ā simple but lossy (no undefined/Dates)