I have such object:
const obj = {age: 20}
But value of age
can be changed , for example, to 30
;
Then I need to compare previous object's values and new object's values. So how I can save first object before it will change it's structure.
const obj = {age: 20} //object what I have at the beggining
const newObj = obj; // {age: 30}
JSON.stringify(obj) === JSON.stringify(newObj) // false