You simply need a deep copy of the object can be passed in the following function
function deepCopy(obj) { if (typeof obj === 'object') { return JSON.parse(JSON.stringify(obj)); } else { return obj; } }
You simply need a deep copy of the object can be passed in the following function
function deepCopy(obj) { if (typeof obj === 'object') { return JSON.parse(JSON.stringify(obj)); } else { return obj; } }