Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
Reference / JavaScript

structuredClone()

Creates a deep clone of a given value using the structured clone algorithm. Supports Maps, Sets, Dates, RegExps, TypedArrays, and circular references.

Syntax
structuredClone(value: any, options?: { transfer?: Transferable[] }): any

Parameters

NameTypeDescription
valueanyThe object to clone.
optionsobjectOptional transfer list.

Examples

Deep cloning complex nested object
const original = { date: new Date(), map: new Map([['key', 123]]), nested: { count: 1 } };
const copy = structuredClone(original);
copy.nested.count = 99;
console.log(original.nested.count); // 1 (Unaffected)
Significantly faster and more robust than JSON.parse(JSON.stringify()). Does not clone functions or DOM nodes.