Copying objects in Javascript
In this article we will look at the various ways an object can be copied in Javascript. We will take a look at both shallow and deep copying. While shallow copying is rather straightforward, deep copying is more tricky. Currently, there is a HTML5 specification for a deep copy algorithm but it is not publically available yet. Until then, use a well-known library. If the source object has a well-known structure either: use JSON serialization and deserialization, or roll your own algorithm for better performance / custom serialization.
smalldata.tech