const a = { x: 5 };
const b = a;
b.x = 999;
Now a.x is also 999.
This breaks apps everywhere.
✔ Fix: Clone before modifying
const b = structuredClone(a);
or:
const b = { ...a };
Daily micro-tips for C#, SQL, performance, and scalable backend engineering.
const a = { x: 5 };
const b = a;
b.x = 999;
Now a.x is also 999.
This breaks apps everywhere.
const b = structuredClone(a);
or:
const b = { ...a };