3 Ways to Clone Objects in JavaScript | SamanthaMing.com

Great blog post explaining different ways for cloning objects in JavaScript. Also explains the difference between shallow and deep copy.

As you can see, the deep copy is a true copy for nested objects. Often time shallow copy is good enough, you don’t really need a deep copy. It’s like a nail gun vs a hammer. Most of the time the hammer is perfectly fine. Using a nail gun for some small arts and craft is often case an overkill, a hammer is just fine. It’s all about using the right tool for the right job

Source: 3 Ways to Clone Objects in JavaScript | SamanthaMing.com

Leave a Reply

Your email address will not be published. Required fields are marked *