All VideosJavaScript Tutorials

Shallow Copy and Deep Copy in JavaScript | JavaScript Tutorials in Hindi | Interview Question #11

In JavaScript, variables that store non-primitive data types such as objects and arrays actually store references to the memory location where the data is stored. This means that when you copy an object or an array, you are not actually creating a new object or array, but rather creating a new reference to the same memory location.

There are two ways to copy objects and arrays in JavaScript: shallow copy and deep copy. Shallow copy used to copy a object but deep copy used to copy nested objects.

Leave a Reply

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

error: Content is protected !!