loading...

re: What's the best way to deeply clone an object in JavaScript? VIEW POST

FULL DISCUSSION
 

let obj = {stuff: {
more_stuff: "this",
list: [1,2,3]},
}

JSON.parse(JSON.stringify(obj))

 

This is only a shallow clone so nested reference types would not be cloned

code of conduct - report abuse