Deep Copy vs Shallow Copy 👨💻
Deep Copy:
1. Creates a new object and recursively copies all nested objects and arrays.
2. Changes made to the copied object won't affect the original object because the nested objects and arrays are stored in separate memory locations.
Shallow Copy:
1. Creates a new object but only copies the references to the nested objects and arrays.
2. Changes made to the copied object's nested objects or arrays will also affect the original object because both refer to the same memory location.
Please refer to the following video tutorial to learn more about this concept with examples.