'JSON.stringify' does not work if you use any memory references in your object:
functiontest(){console.log("This is a Test")}constperson1={name:{first:"Alex",last:"Telles"},f:test,address:"XYZ"}person1.f()constperson2=JSON.parse(JSON.stringify(person1));person2.f()//Uncaught TypeError TypeError: person2.f is not a function
Intrestingly, f is completely skipped in the output:
'JSON.stringify' does not work if you use any memory references in your object:
Intrestingly, f is completely skipped in the output:
I am gonna edit my article with these later
Yeah, that's a concern.
So,
structuredCloneis the only way.Is there any other workaround?