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)