On this page
  1. Global.structuredClone
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

Global.structuredClone

Prev: Global | Up: Global | Next: Number_isNaN
Rel: Global, JS Core Syntax & Types
Ref: MDN Web Docs — Global.structuredClone
Tags: #public #web #javascript #builtins #global #tier/core


Signature & Overview

structuredClone(value, options?)

Native deep clone supporting Date, Map, Set, RegExp, TypedArray, and circular references.

Notes & Pitfalls

Example

const orig = { tags: new Set(["js"]), nested: { count: 1 } };
const copy = structuredClone(orig);
copy.nested.count = 99;
console.assert(orig.nested.count === 1 && copy.tags.has("js"));

Linked from

Related notes