structuredClone()
The structuredClone() method of the Window interface creates a deep clone of a value using the structured clone algorithm.
The method also allows transferable objects in the original value to be transferred rather than cloned to the new object. Transferred objects are detached from the original object and attached to the new object; they are no longer accessible in the original object.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 98 | 98 | 94 | 15.4 | 98 | 15.4 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
JAVASCRIPT
structuredClone(value)
structuredClone(value, options) Use cases
-
Using structuredClone()
The structuredClone() method of the Window interface creates a deep clone of a value using the structured clone algorithm.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.