I want to make a deep copy of a object, say I have a object:
const oriObj = {
id: 1,
version: 1,
person: 'jack'
};
so after a click event
, oriObj
is set to be a empty array []
, but I still want to get the original value in the oriObj
for example the id and version. I was trying to make a deep copy, so the no matter how oriObj
is changing, once I am getting the value of oriObj in the beginning, I deep copy it and store in so it won't become empty array. I have tried several method, but it won't work, I am still getting empty array after the click event.