Skip to content
← All posts

TIL: structuredClone exists

1 min read#javascript

structuredClone deep-copies objects, including Date, Map and Set, without JSON.parse(JSON.stringify(...)) tricks.

clone.js
const copy = structuredClone({ when: new Date(), tags: new Set(["a"]) });