I am trying to clone an object created with new
. The only way I found to do it is:
let tmp = Object.create(instance.__proto__);
let obj = Object.assign(tmp, instance);
This examples works and does the job, but doesn't look like a proper solution. I was wondering if there is a better way to clone the object created with new
?
Any help will be appreciated!