coderef

structuredClone()Baseline · Widely available

The structuredClone() global method creates a deep copy of an object. Values that cannot be cloned can instead be transferred, making the original value no longer usable.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Mar 14, 2022. Widely available since Sep 14, 2024.

Browser support

DesktopChrome
1–97Not supported
98+Supportedsince Feb 1, 2022
Current: 155
Edge
12–97Not supported
98+Supportedsince Feb 3, 2022
Current: 154
Firefox
1–93Not supported
94+Supportedsince Nov 2, 2021
Current: 157
Safari
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27
MobileChrome Android
18–97Not supported
98+Supportedsince Feb 1, 2022
Current: 155
Firefox Android
4–93Not supported
94+Supportedsince Nov 2, 2021
Current: 157
Safari iOS
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

JS
const original = { date: new Date(), tags: new Set(["a"]), nested: { n: 1 } };
const copy = structuredClone(original); // deep copy, keeps Date/Set/Map
copy.nested.n = 2;
console.log(original.nested.n); // 1

Feature detection

JS · check before using
if ("structuredClone" in globalThis) {
  // structuredClone is available
} else {
  // load a polyfill or use a fallback
}