What is the most efficient way to deep clone an object in JavaScript?
Native deep cloning There’s now a JS standard called “structured cloning”, that works experimentally in Node 11 and later, will land in browsers, and which has polyfills for existing systems. structuredClone(value) If needed, loading the polyfill first: import structuredClone from ‘@ungap/structured-clone’; See this answer for more details. Older answers Fast cloning with data loss – … Read more