-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deep copy #9
Comments
Hi there. I had the same question as you when I was implementing something. There is a way to do this but it is not something directly provided by JavaScript but it worked for me. You can do the following:
The stringify function first puts the object into a stringified json string and then parses it again, which deep copies the object. However, I warn you that this is an expensive function and can really slow down the program if used many times so use with caution. There are other ways to copy objects I believe and they are as follows:
Moreover, jQuery provides a way to deep copy too!:
Cheers! 👍 |
Is there a way do deep copy an object?
Thanks.
The text was updated successfully, but these errors were encountered: