I'm trying to clone and object, then make changes to the original object and do some tests encase the test fails restore the clone back.
Currently I've tried _.clone (underscore), angular.extend, angular.merge, angular.copy, Object.create, Object.assign, JSON.parse(JSON.stringify(o)), but somehow my changes in the original object gets reflected back into the clone.
_.clonedoes shallow copy of the object, but you need a deep copy. Try_.cloneDeepinstead.var clone = JSON.parse(JSON.stringify(o))may help?