Is this function a good object deep clone function

Hello,

I made a a function that clone an object. It takes the source object variable and a target object variable. The function copies the source object variable (not just the reference) to the target object variable to create an object independent from the first. Please let me me know if it’s well done and if there’s anything I could do to make it better.
Here is the deep clone function and here’s a link for more insight.
I know it isn’t part of MDN but your help would be deeply appreciated.
Thank you in advance for your help !

Hello @TheRealSuperhuman

you doing great well done using recursive function call
by the way there already deep clone function called cloneDeep(obj) that you can use to do it for you https://attacomsian.com/blog/javascript-clone-objects

pleasae notice it not supported on old browser but since microsoft allowed the new edge to be installed on windows 7 then i think it could be fine

hope that help and have a nice day :slight_smile:

I don’t understand the link or Lodash.

it’s library that you can include in your project then you use it’s extra api in your code

check this lengthy https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript
it has more info and many way to achive the same