JavaScript Object Clone | Deep and Shallow Copy in Hindi | Interview Questions
ฝัง
- เผยแพร่เมื่อ 28 ก.ย. 2024
- In this javascript object deep copy and shallow copy tutorial, we learn to clone object in javascript and we learn about deep copy of object and shallow copy of object . this video made by anil Sidhu in Hindi language
Steps
what is object clone in hindi
why we need object clone
type of object clone
Example
deep copy of object
shallow copy of object
Interview Questions
React js Latest Playlist in hindi : • React tutorial for beg...
inst id: @code.steps
1. Objects are copied by reference and variables by value.
2. To copy objects by value:
==>Object.Assign({}, obj)
==>{...obj}
3. The above method is shallow copy. It copies only top-level fields.
4. To copy nested objects, deep copy comes into picture.
==>JSON.parse(JSON.stringyfy(obj));
5. But the above doesn’t copy functions and dates. So, loadash is used.
==>_.cloneDeep(obj)
The best explanation one could have asked for. I just have one question what if the Interviewer ask which is better Deep copy or shallow copy?
They can not ask which one is better. We choose copy type over requirement
Bhai itte aache se samjata hai practice ki jarorat bhi nahi padi sidda ghus gaya dimag mai.
You are great sir your videos very helpful and You always talk about the important things, you don't prolong the conversation. Thanks
thank you bro it was really helpful ..mere bhot sare confusion dur ho gye ....keep learning & keep teaching us ...best of luck bro
Hi tutor your Urdu accent is unique and guaranteed quality concept also makes your channel awesome. speak English where necessary because urdu is my mother tongue easy to understand.
I saw lots of video but i also get confusion in shallow and deep copy but in this video i understand total about that. Nice work buddy...!
Thanks and welcome
what a explaination👏gudluck brother
It's so cleared now ❤️👍 about objects. Thanks 😊
I am soo happy with your concept 😍 just e bolna chatahu aiiisa bahut sara interview question chaiye jojo question pucha jatahe
sir you were using spread operator not destructuring in shallow copy
Very awesome explanation sir.
bind call apply use nhi kar sakte kya fir methods ke liye jo bhi obj mai present
hai
Very nice teaching. Very good way of explanation.
bahut khub bhai ji
Thank you so much , you explain us in very simplest way. 😊
My pleasure 😊
Great explanation sir
Good explanation easy to understand
Glad to hear that
Awesome explaining sir shallow copy and deep copy.its very helpfull video thank you so much
Thanks and welcome
Very nice sir but pls share this with us
Really good video bro
Very well Explained. thank you .
Very well Explained Anil..!!☺️
Thank you so much
Nice explanation
v nice sir.... amazing.... thank you...
This keyword or event loop
helpful brother
Really good explanation 👍
if we put an console in between like:-
let obj = {
name: "peter",
};
console.log(obj);
let user = obj;
user.name = "hello";
console.log(obj);
than the result is
peter
hello
why it already update the obj value than why the peter prints
why the hello not prints 2 times
bro the output is correct because you console.log('obj') before copy it to the user.
so what then if we have a object and it properties with function and we have to copy it by `let obj2 = Object.assign({}, obj1);` and modified one property value in obj2 so it will be shallow copy or deep copy???
shallow copy
Thank you so much sir.
What is the difference between deep copy/shallow copy and deep cloning/shallow cloning, are they same?
Looking forward!
Wow💐
Javascript symbols like NaN bhi nhi honge deep copy
Wowww
😃Like to bantaa hai Boss😃
Really, amazing & to much concepts have been cleared
Thank you so much 😀
Great❤️❤️❤️
Visibal issues hy
Thank you aap mat boliye balki hame bolne dijiye
Thank you
👍
lodesh 🤌
Before watching this video, I was having a lot of confusion about deep copy and Shallow copy but now it's crystal clear. Thanks a lot. Your teaching style is awesome.
I have a question regarding shallow copy please explain. U told 8:11 that in shallow copy means value of a object is copied not the reference . But when i search in google there i found inside bracket (In Shallow copy, a copy of the original object is stored and only the reference address is finally copied. ).
please sir clear this to me
Rather then going to browser console all the time
Y dont you try { node (name of the JS file) } and press enter
in your vs code terminal
it will be more helpful
I don't know how to thank you man!!! I was stuck on a bug for like 24 hours due to this problem....Thanks you loads!!! liked and subscribed!!!
made it so easy, keep up...
Thanks for this video sir. Bt humlog fresher hai to samjhane ke tym thoda sa dhire samjhenge to aur bahetar hoga. Again saying nice video sir keep it up.
Dhannebad....☺
structuredClone is a new way to create deep copy in js.
Does the same thing goes with array?
Yes
Very helpful ☺️ 👍
paji Bht hi sahi explain kita tusi att krti, paji ik question a ki same cheej arrays nal b hundi a ?
Please make video of oops in js
Sir opps me video
You Didn't even give the definition what you have said you'll provide, "Baad me"!
Thank you so much, simplest explanation
Definition Shallow copy and deep copy ?
brother good teaching doubt clear thank u
thanks bro itna deep me batane ke liye
very well explained thanks
Well done master khup mast
maza aa gya🎉🎉🎉🎉🎉❤❤❤❤❤❤❤
keet it up. best explaination.
Great explanation thanks.
Repository name plz
Finally!!! I am able to understand Shallow and Deep copy. Thank you
This is an underrated channel. All these awesome videos should reach to more people.
Do Like and subscribe this channel
Hi
sí, manzana come amigos
Just brilliantly explained. Very apt, systematic and well defined. Removed all my confusions forever!
very good keep it up bro
great video
define in well way
Nice Explaination
Useful video ❤
Helpful video
Sir bohot dino bad channel mila bawal hi padha rhe ho app 🙏🏻 1:27
good explation
Amazing explanation..best explanation in TH-cam for this topic .
Thanks a ton
Nyc clear concept
the best🙏🙏🙏🙏🙏
Thanks a lot
veer code da link provide krdo
mil nai rea
Thanks
❤❤❤❤useful
Nice sir
superb
very well explained. thank you
Glad it was helpful!
Just preparing for an interview and it helped me a lot, thanks man ♥️
Best of luck!
Insightful video.Everything got crystal clear thank you.!
please explain Array.prototype.slice & JSON.parse(JSON.stringify(obj))
Thank you sir . thank you .After a long time , I understand the concept of deep copy and shallow copy from this video.
How can you say solution is not available in javascript Even lodash developers have implemented using javascript only, just that they are providing it as a package. That's misleading
sir destructing method can be used? let user=[obj] and then we can change both values? is this feasible to use
destruction will do only shallow copy not deep
@@codestepbystep it helped me for todays interview sir....😊😊😊i have watched complete tutorial of mern and it helped me a lot....i hade made notes of your all videos....and while making projects i use it a lot....Sir websockets and tensorflow js if possible...❤️❤️❤️it helped me a lot
Your video is helpful for me so can you please make video for Oops in JavaScript...thank you
No scope to dislike the video. Nice explanation 10/10
Sir, please change your code editor, letter s not visible!!!
very impressive explanation . thanku sir
amazing class
Glad you think so!
Really nice explanation step by step ❤
Alhamdulillah all confusion cleared now
now cristal clear about deep and shallow thankyou so much bhaiya g