For me , a great video for revision. Thanks. Just a minor thing I would like to add for deep and shallow copy. While we use Object.assign({}, obj) or use spread operator {...obj} , only the primitive objects inside the main object gets deep cloned into new object. For the nested objects, only the reference is stored, which is basically shallow copy.
Can you please explain why the members array remained same when person is set to null and why it changed to null only on changing the name property in the person object at 21:50
Because we are reassigning the value which replaces the previous object, but in case of name properly, we are changing the value of that key which has the reference to the original object.
Hey I was watching this tutorial for interview prep, got one doubt this cloning objects with different ways have its own limitiation. Most common is method is not preserved and also complex entities like Set, Map, Regex. loadhash would simpilfy this but how we can do this without using external library is there any Polyfills to it?
Great job.but Object.assign, stringifying then parsing and spreading are not the correct way to create a deep copy of an object. because out of these three methods some are not compatible for nested objects and some are not compatible for functions and Dates inside the objects. In order to create a deep copy of an object we gotta install a third party library called lodash, which has got a functionality Clonedeep, which can help us in this.
Bro, I have gone through some videos, you are simply rocking and just you inspired me a lot. what should I do to pro in javascript like you ? is there any best book for javascript and as well as practice problems? please refer to any suggestions and root map. by the by, im from Non-IT background.
Can u explain more for the question at 26:03, it will be more helpful for people who are not able to understand the concept of referencing and return statement
why my nums object is changing can we return new. object without changing nums value ?? let nums = { a: 100, b: 200, title: "My nums", }; function multiplyByTwo(obj) { for (let key in obj) { if (!isNaN(obj[key])) { obj[key] *= 2; } } return obj; } multiplyByTwo(nums);
hi ,,Piyush.. you put great effort for the javascript developers comunity, but you give the example of deep copy of an object is wrong, you just copy the shallow copy of an object, i hope you finds it well and should correct this. And once again i really say thanks for the this type of content;👌👌👍👍
I did not get this part, if someone can help: Since we are assigning obj1 to obj2, ideally whatever is the value is set to obj1 should be the same for obj2, right? as in, for both, the name should by 'pi', and age 7, isnt it? function change(obj) { obj.name = 'pi', obj = { name: 'hena', age:9, }
Very nicely explained about json.parse and json.stringify with their use case. Please make more such videos on intserview questions based on output and coding.
Hi all... i have small doubt for the below object...how to find key and value both ("second " : 2) in the below object..please i need your solutions const iem = { "first" : new Date(), "second" : 2, "third" : "test" }
I really like the video!!!! But why do you ask to watch a different video explaining simple things. You can give the basic context and ask to watch the other video for complete understanding if marketing is more important. I personally felt this.
Read it.....👉 Most welcome brother,lot of people watching you , yesterday I watched technical suneja live and thaire one of the people tell to Ajay sir that's I'm watching roadside coder js videos.and Ajay sir also appreciate it.💯♥️👍 Keep it up
32:25 Yesterday I shared you timestamp but I don't know how it will didn't upload. Can we connect on LinkedIn I have some few queries if you help me out it will lot toe.
Great video, thank you. For the last question I'm confused, Object.assign and spread operator, do they really create a deep copy? Would have been great if the video ended with the sone nested object examples.
Can you make videos related to dsa using JavaScript for the dsa round in frontend interviews - also give some idea about how to get frontend internship opportunity while in college. hoping for your reply :)
I have been asked about how to print keys i was knowing the concept of foreign loop but don't know what happened during the interview was not able to tell that
🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details
For me , a great video for revision. Thanks.
Just a minor thing I would like to add for deep and shallow copy. While we use Object.assign({}, obj) or use spread operator {...obj} , only the primitive objects inside the main object gets deep cloned into new object. For the nested objects, only the reference is stored, which is basically shallow copy.
Kindly make a video on interview questions on cookies , local storage & session storage … also to mention nice explanation on the topics , Thank you 🙏
Great video! Also, a video on local storage, session storage, and Indexed DB with the use case would be a great one.
Can you please explain why the members array remained same when person is set to null and why it changed to null only on changing the name property in the person object at 21:50
Because we are reassigning the value which replaces the previous object, but in case of name properly, we are changing the value of that key which has the reference to the original object.
Can you provide a link or something related to property you discussed at timestamp 22:32, where you set person to null? It would be really helpful.
Great explanation! Object.freeze and Object.seal could have been added to the video.
Last Que's Answer is not perfectly correct ... operator make shallow copy and JSON.stringify can't mentain order
Please make vdo on local storages, session, cookies And cache too.. Thanks you bro in advance.
I didn't find such a great video on Internet !! Thanks, man for such amazing content❤️Keep posting such content !!
Please make video on local storage, session storage and cookies ... It will be great help 🙏
3:00
thank you
great explanation as always u do 👍 and yes ye dil mange more 😀 so plz post a video based on local storage cookies and sessions deeply
Hey I was watching this tutorial for interview prep, got one doubt this cloning objects with different ways have its own limitiation. Most common is method is not preserved and also complex entities like Set, Map, Regex. loadhash would simpilfy this but how we can do this without using external library is there any Polyfills to it?
Road side paani-puri always awesome like Road side Coding... 🤟🤟😃😃
Great job.but
Object.assign, stringifying then parsing and spreading are not the correct way to create a deep copy of an object.
because out of these three methods some are not compatible for nested objects and some are not compatible for functions and Dates inside the objects.
In order to create a deep copy of an object we gotta install a third party library called lodash, which has got a functionality Clonedeep, which can help us in this.
Please make a series of output based....It would really be very helpful.....
Yes please make a video on local storage and session storage
I have little bit confusion over changeAgeAndReference topic time 25:50 personObj1 how come age : 25
JSON.stringify and JSON.parse will only work on JSON safe objects. If the objects contain functions, symbols or dates that won’t create a deep clone
Hi bro, nice session. Pls do a video for How to make api's very secure?.. what are the possibilities? Jwt, Refresh token, etc
Great but some object methods are missing .....
Like freeze and all
Yes, please make some more lectures on interview questions including session and local storage
Bro, I have gone through some videos, you are simply rocking and just you inspired me a lot.
what should I do to pro in javascript like you ? is there any best book for javascript and as well as practice problems?
please refer to any suggestions and root map.
by the by, im from Non-IT background.
problems and than volu automate the boi cuz I didn’t know how to sidechain. My one buddy produces riddim and he legit saw my daw
Object.assign will create shallow copy not the deep copy if we have nested objects please kindly note this
Can u explain more for the question at 26:03, it will be more helpful for people who are not able to understand the concept of referencing and return statement
Thank You Soo Much I learnt Many Things
Bro can you please tell me some good books for javascript and react.
Portfolio making please
Hey wouldn't Object.assign({} , user) and the spread operator do shallow copy? vs the JSON.stringify and parse will do deep copy?
Object.assign and spread are shallow copy for nested object for direct properties it’s a deep copy.
Yes I've mentioned that this doesn't work for nested properties.
why my nums object is changing can we return new. object without changing nums value ??
let nums = {
a: 100,
b: 200,
title: "My nums",
};
function multiplyByTwo(obj) {
for (let key in obj) {
if (!isNaN(obj[key])) {
obj[key] *= 2;
}
}
return obj;
}
multiplyByTwo(nums);
let nums = {
a: 100,
b: 200,
title: "My nums",
};
function multiplyByTwo(obj) {
let newObj = Object.assign({}, obj);
for (let key in newObj) {
if (!isNaN(newObj[key])) {
newObj[key] *= 2;
}
}
return newObj;
}
console.log(multiplyByTwo(nums));
console.log("My Nums", nums);
Sir, please make video on session storage and local storage
I'm brazilian, my english is not good at all, but I understood
Great video Piyush 💯 would you be able to please do a video on interview questions related to local storage, sessions and cookies?
Question 2 : 7:15 -> Answer
function multi2(obj) {
return Object.entries(obj).reduce((acc, curr) => ({
...acc,
[curr[0]]: isNaN(curr[1]) ? curr[1] : curr[1]*2
}), {})
}
kindly make video on localStorage session
hi ,,Piyush.. you put great effort for the javascript developers comunity, but you give the example of deep copy of an object is wrong, you just copy the shallow copy of an object, i hope you finds it well and should correct this. And once again i really say thanks for the this type of content;👌👌👍👍
You can use structuredClone() method to make a deep copy.
Yes make a video on local storage, session storage and cookies etc.
Please make video on local and session storage and cookie
Make a video on the loacal Storage, cookies and session storage
how well you have explained such complex topics ... great work ....keep it up ..!!!!
Thank you, I will
make video on local storage and session storage
bhaiya who is Lydia i think Lydia is your crush 😅♥
why don't you use node js and run js code in terminal
Excellent but your pace is fast
Quite helpful !
I did not get this part, if someone can help: Since we are assigning obj1 to obj2, ideally whatever is the value is set to obj1 should be the same for obj2, right? as in, for both, the name should by 'pi', and age 7, isnt it?
function change(obj) {
obj.name = 'pi',
obj = {
name: 'hena',
age:9,
}
return obj;
}
var obj1 = {
name: 'div',
age: 7,
}
const obj2 = change(obj1);
console.log(obj1);
console.log(obj2);
Didnt understand 13th solution
seem to be possible or straight forward.
sick of it!! !!!! anybody got any tips to help?? close on throwing my laptop out the window! got the Full package on soft feel its a waste of
What's wrong?
Why don't invinite amazon frontend engineeer for interview experience, we will learn alot
Good idea
This is why I HATE JavaScript. It's the only language where you need master its STUPIDITY and FAULTS to pass a job interview 🤦♂
Its ok bro, high salary is difficult to get.
@@RoadsideCoder
Or rather get the high salary using different techs and languages.
The last way of cloning an object is to spread the object not destructure it correctly. Can you please correct me .
nope, its to use structuredClone() method
Very nicely explained about json.parse and json.stringify with their use case. Please make more such videos on intserview questions based on output and coding.
Please bolne ka speed Thora Kam kijiye, samajh ne me thoda asani hoga, itna fast bolrehe ho, kuch vi samajh me nehi araha hain please 😊
bhai aap video a speed 0.75x pe krke try kro, better experience hoga
pls make video on storage
How we can compare two objects with same key-value pair but in different order? Also we are not allowed to use Lodash. Only Javascript solution.
Hi all... i have small doubt for the below object...how to find key and value both ("second " : 2) in the below object..please i need your solutions
const iem = {
"first" : new Date(),
"second" : 2,
"third" : "test"
}
Bhai please problem solving ka bhi , sirf list of problems Jo usually FE me puchte hai.
Yes I have planned that too
I really like the video!!!! But why do you ask to watch a different video explaining simple things. You can give the basic context and ask to watch the other video for complete understanding if marketing is more important. I personally felt this.
Fellow devs below is a Polyfill for deep copy
function deepCopy(obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
var copy;
if (Array.isArray(obj)) {
copy = [];
} else {
copy = {};
}
for(key in obj) {
copy[key] = deepCopy(obj[key])
}
return copy;
}
I like your microphone. Can you give me ?
Sure, send me ur address 🤓
Doing great job
Bro is obsessed with 69 😂
Hi.
But we can't reassign to a constant variable.
As personObj1 is constant variable then why it is able to reassign in the function changeAgeandName?
5:38 Trying to loop through an object will NOT work in react. it will give "'key' is not defined"
TNice tutorials tutorial was worth it, I understood everytNice tutorialng now
Object.assign and destructuring creates shallow copy only.
Yes, please make a video on differences between session storage, local storage and cookies when and how to use them
Read it.....👉
Most welcome brother,lot of people watching you , yesterday I watched technical suneja live and thaire one of the people tell to Ajay sir that's I'm watching roadside coder js videos.and Ajay sir also appreciate it.💯♥️👍
Keep it up
Oh wow bro, can u provide me the timestamp of that video where he said that?
@@RoadsideCoder 32.25
32:25
Yesterday I shared you timestamp but I don't know how it will didn't upload.
Can we connect on LinkedIn I have some few queries if you help me out it will lot toe.
@@ShubhamPatil-rr4on Sure
You guys should consider getting Caustic 3, it helped understand the basics I tNice tutorialnk it´s even free for PC, on the phone it costs a little.
+1
Great video, thank you.
For the last question I'm confused, Object.assign and spread operator, do they really create a deep copy? Would have been great if the video ended with the sone nested object examples.
Sath sath JSON bhi bata dete...
great big fan now
awesome ❤❤
that marijuana
Can you make videos related to dsa using JavaScript for the dsa round in frontend interviews - also give some idea about how to get frontend internship opportunity while in college. hoping for your reply :)
Sa here...lol
Thanks..Amazing and very useful video.
waiting 🔥
Awesome
Please create a video on interview questions asked about Local Storage and Sessions Storage.
good
Brother please be quite slow. You are way too fast.
you can change the speed of the video to 0.75x
Thanks.
Please make on cookies , local storage, session related stuff every things
..
Thanks
works great and without any problems
I have been asked about how to print keys i was knowing the concept of foreign loop but don't know what happened during the interview was not able to tell that
please make a video on How much javascript is enough for interviews and what are the important topics to focus on for interviews
Please create more videos for this playlist.
Thanks
Please make portfolio video egarlu waiting...
100% interview preparation..........very very thankfull...waiting for more such videos.....
Checkout the full course here - roadsidecoder.com/course-details
Javascript is really super weird man
weird but crazy 😅
I didn't know this video existed! Thanks bro! Really grateful.
Great Video, Please make video on cookie, session and local storage with examples
Really really help to me, thank you much brother. You are really doing a good job. God bless you, man.
Please make the video on local storage, session storage, cache and cookies etc