1
JavaScriptIntermediate#es6#operators
Use structuredClone for most data, or a recursive clone for custom needs. Spread and Object.assign only copy one level, and JSON round-tripping loses Dates, Maps, functions and undefined.
const deep = structuredClone(obj);
const shallow = { ...obj }; // nested objects still shared