Thank you,
And I have some questions about this,
When I copy:
constobj={n1:3,n2:newNumber(4)};constnewObj=JSON.parse(JSON.stringify(obj));console.log(typeofobj.n1);// numberconsole.log(typeofobj.n2);// objectconsole.log(typeofnewObj.n1);// numberconsole.log(typeofnewObj.n2);// number
Thank you,
And I have some questions about this,
When I copy:
obj.n2
andnewObj.n2
are the same?And as in my previous comment, when I copy:
Another question, when I create an object by
Object.create
like this:Why that, we cannot clone it without readable it? Please help me understand, thank you!