Are Shallow Copies Dangerous?
Learn if using shallow copy is safe or not.
We can conclude that making shallow copies are sometimes not enough. When the copied object is modified, it may result in unwanted consequences. Most of the time, software development best practices and restricted workflow allow us to use shallow copies of objects without problems.
For instance, in BackboneJs, the default implementation of the toJSON
method of models looks like this:
Are shallow copies dangerous?
Get hands-on with 1200+ tech skills courses.