Рет қаралды 15,245
In this video, I have explained in detail, how to copy
javascript object and what is shallow and deep copy in javascript
Shallow copy is also identified by pass by Reference , when you
make a copy of original variable into another variable(copied) by using
assignment operator(=), that time only the reference address
of original variable is copied into another variable instead of original
values.
So at last both variables refer to the same value. So when you make any changes in
new variable if will also mutate or change the original variable
Deep Copy:
Deep copy is also identified by pass by Value, when you make a copy of
variable into another variable by using assignment operator, at that time
all the values(object, arrays) along with reference address of original variable
is copied into another variable.
At last, both variables refer to different referenced
values. So when you make any change in new variable it won't mutate the original variable.
Watch video on spread operator: • ES6 Tutorial #6: Sprea...
Watch video on mutable/immutable object : • ES6 Tutorial #5: Mutab...
I have one assignment at the end of the tutorial.
Please support my channel,🙏 by showing your love❤️ by liking and sharing my video, so that I can reach to more people and can help them too.
Watch my Angular playlist :
Angular : • Introduction- Angular ...
Follow me:
Facebook: / angularjs4beginners
LinkedIn: / nisha-singla-82407aa0
Instagram : / passion4code
For more such interesting videos, please subscribe to my channel and stay connected.
#javascript #NishaSingla