TIL: structuredClone exists
1 min read#javascript
structuredClone deep-copies objects, including Date, Map and Set, without JSON.parse(JSON.stringify(...)) tricks.
const copy = structuredClone({ when: new Date(), tags: new Set(["a"]) });structuredClone deep-copies objects, including Date, Map and Set, without JSON.parse(JSON.stringify(...)) tricks.
const copy = structuredClone({ when: new Date(), tags: new Set(["a"]) });