I just came across this concept of
var copy = Object.assign({}, originalObject);
which creates a copy of original object into the \"
Other answers are complicated.
Some don't answer the question at all.
Below worked for me
// orignal object with deep keys
var originalObject = {
k1: "v1",
k2: "v2",
deepObj: {
k3: "v3",
k4: "v4"
}
};
// make copies now
var copy1 = JSON.parse(JSON.stringify(originalObject));
var copy2 = JSON.parse(JSON.stringify(originalObject));
Hope that helps.