Skip to main content

One post tagged with "javascript"

View All Tags

Shallow Copy vs. Deep Copy

· One min read
Haochen Qi
Fullstack Developer

question Objects are the basic blocks of JavaScript. An object is a collection of attributes, and an attribute is an association between a key (or name) and a value. Almost all objects in JavaScript are Object instances at the top of the prototype chain.

When it comes to copying objects in JavaScript, you need to know whether you need to do a shallow copying or a deep copying. In this article, we will go through these two different ways to copy objects.