I wanted to deep copy some objects in javascript so that my reducer is pure in redux. Some properties have 1 level of nesting and some have 2 and some have 3 like:
var x = {a:9}, y:{a:{b:9}}, z = {a:{b:{c:9}}};
So should I use some other technique like:
var newX = {...x}, newY = {a:{...y.a}}
Should I continue to use the same technique in a loop - write my custom deep copy for 3 level nesting also or should I simply use:
var newZ = JSON.parse(JSON.stringify(z));
to create my deep copy.
What is the fastest way alternative to JSON.parse(JSON.stringify(value))??