Javascript Interview Questions ( Objects ) - Output Based, Destructuring, Object Referencing, etc

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ต.ค. 2024

ความคิดเห็น • 183

  • @RoadsideCoder
    @RoadsideCoder  2 ปีที่แล้ว +1

    🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details

  • @chinmoyborah376
    @chinmoyborah376 2 ปีที่แล้ว +24

    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.

  • @prangshugogoi5624
    @prangshugogoi5624 2 ปีที่แล้ว +44

    Kindly make a video on interview questions on cookies , local storage & session storage … also to mention nice explanation on the topics , Thank you 🙏

  • @girishanavani8620
    @girishanavani8620 2 ปีที่แล้ว +9

    Great video! Also, a video on local storage, session storage, and Indexed DB with the use case would be a great one.

  • @kmsnymisha4607
    @kmsnymisha4607 2 ปีที่แล้ว +5

    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

    • @RoadsideCoder
      @RoadsideCoder  2 ปีที่แล้ว +1

      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.

  • @ashuprakash6697
    @ashuprakash6697 2 ปีที่แล้ว +6

    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.

  • @deepakkolare
    @deepakkolare 2 ปีที่แล้ว +5

    Great explanation! Object.freeze and Object.seal could have been added to the video.

  • @shiva_krishna_rama
    @shiva_krishna_rama ปีที่แล้ว +1

    Last Que's Answer is not perfectly correct ... operator make shallow copy and JSON.stringify can't mentain order

  • @RahulKumar-ew1qw
    @RahulKumar-ew1qw 2 ปีที่แล้ว +2

    Please make vdo on local storages, session, cookies And cache too.. Thanks you bro in advance.

  • @ashishmadan5700
    @ashishmadan5700 2 ปีที่แล้ว +3

    I didn't find such a great video on Internet !! Thanks, man for such amazing content❤️Keep posting such content !!

  • @BrijeshSingh-dp1ku
    @BrijeshSingh-dp1ku 2 ปีที่แล้ว +2

    Please make video on local storage, session storage and cookies ... It will be great help 🙏

  • @sanamukhtar4008
    @sanamukhtar4008 4 หลายเดือนก่อน +1

    3:00

  • @sanamukhtar4008
    @sanamukhtar4008 4 หลายเดือนก่อน +1

    thank you

  • @k.ksharma4457
    @k.ksharma4457 2 ปีที่แล้ว +2

    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

  • @rajathmr4171
    @rajathmr4171 3 หลายเดือนก่อน

    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?

  • @sanjaytk
    @sanjaytk หลายเดือนก่อน +1

    Road side paani-puri always awesome like Road side Coding... 🤟🤟😃😃

  • @sagarpatel8853
    @sagarpatel8853 29 วันที่ผ่านมา

    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.

  • @abhishekkerketta9722
    @abhishekkerketta9722 2 ปีที่แล้ว +2

    Please make a series of output based....It would really be very helpful.....

  • @hamid.mahmood96
    @hamid.mahmood96 2 ปีที่แล้ว +2

    Yes please make a video on local storage and session storage

  • @karthikeyasoft
    @karthikeyasoft ปีที่แล้ว

    I have little bit confusion over changeAgeAndReference topic time 25:50 personObj1 how come age : 25

  • @pratikwadekar4981
    @pratikwadekar4981 2 ปีที่แล้ว +1

    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

  • @tamilselvans147
    @tamilselvans147 2 ปีที่แล้ว +1

    Hi bro, nice session. Pls do a video for How to make api's very secure?.. what are the possibilities? Jwt, Refresh token, etc

  • @shivambln
    @shivambln 9 หลายเดือนก่อน

    Great but some object methods are missing .....
    Like freeze and all

  • @DeepakSingh-eq8jl
    @DeepakSingh-eq8jl 2 ปีที่แล้ว +2

    Yes, please make some more lectures on interview questions including session and local storage

  • @santhoshburgula6952
    @santhoshburgula6952 2 ปีที่แล้ว +1

    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.

  • @sachinkr0405
    @sachinkr0405 2 ปีที่แล้ว

    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

  • @jaydadhaniya2209
    @jaydadhaniya2209 8 หลายเดือนก่อน

    Object.assign will create shallow copy not the deep copy if we have nested objects please kindly note this

  • @shakeelahmed-wv8oh
    @shakeelahmed-wv8oh 2 หลายเดือนก่อน

    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

  • @malag6358
    @malag6358 13 วันที่ผ่านมา

    Thank You Soo Much I learnt Many Things

  • @bandaumamahesh9346
    @bandaumamahesh9346 7 หลายเดือนก่อน

    Bro can you please tell me some good books for javascript and react.

  • @xync1252
    @xync1252 2 ปีที่แล้ว +1

    Portfolio making please

  • @emilyaung2963
    @emilyaung2963 2 ปีที่แล้ว +1

    Hey wouldn't Object.assign({} , user) and the spread operator do shallow copy? vs the JSON.stringify and parse will do deep copy?

    • @deepakkolare
      @deepakkolare 2 ปีที่แล้ว +1

      Object.assign and spread are shallow copy for nested object for direct properties it’s a deep copy.

    • @RoadsideCoder
      @RoadsideCoder  2 ปีที่แล้ว

      Yes I've mentioned that this doesn't work for nested properties.

  • @akash_gupta_2090
    @akash_gupta_2090 ปีที่แล้ว

    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);

    • @akash_gupta_2090
      @akash_gupta_2090 ปีที่แล้ว

      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);

  • @abcxyz5385
    @abcxyz5385 ปีที่แล้ว +1

    Sir, please make video on session storage and local storage

  • @art.with.yashuu
    @art.with.yashuu 2 ปีที่แล้ว

    I'm brazilian, my english is not good at all, but I understood

  • @lucaliebenberg7565
    @lucaliebenberg7565 ปีที่แล้ว +1

    Great video Piyush 💯 would you be able to please do a video on interview questions related to local storage, sessions and cookies?

  • @code-of-duty
    @code-of-duty 2 ปีที่แล้ว +1

    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
    }), {})
    }

  • @20TUEC012ATHILAKSHMI.M
    @20TUEC012ATHILAKSHMI.M 5 หลายเดือนก่อน

    kindly make video on localStorage session

  • @fewminuteswithabhi2482
    @fewminuteswithabhi2482 9 หลายเดือนก่อน

    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;👌👌👍👍

    • @RoadsideCoder
      @RoadsideCoder  9 หลายเดือนก่อน +1

      You can use structuredClone() method to make a deep copy.

  • @ajmalansari3165
    @ajmalansari3165 4 หลายเดือนก่อน

    Yes make a video on local storage, session storage and cookies etc.

  • @vijenderkumar3034
    @vijenderkumar3034 9 หลายเดือนก่อน

    Please make video on local and session storage and cookie

  • @HimanshuSharma-mx7yx
    @HimanshuSharma-mx7yx ปีที่แล้ว

    Make a video on the loacal Storage, cookies and session storage

  • @sunilr.v.6345
    @sunilr.v.6345 2 ปีที่แล้ว +1

    how well you have explained such complex topics ... great work ....keep it up ..!!!!

  • @PratickChakraborty-f7o
    @PratickChakraborty-f7o 11 หลายเดือนก่อน

    make video on local storage and session storage

  • @100bi8
    @100bi8 ปีที่แล้ว

    bhaiya who is Lydia i think Lydia is your crush 😅♥

  • @rohitahuja999
    @rohitahuja999 2 ปีที่แล้ว

    why don't you use node js and run js code in terminal

  • @ashwani6527
    @ashwani6527 2 ปีที่แล้ว

    Excellent but your pace is fast

  • @ShreyaskarART
    @ShreyaskarART 24 วันที่ผ่านมา

    Quite helpful !

  • @divyasampath2843
    @divyasampath2843 ปีที่แล้ว

    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);

  • @waez2120
    @waez2120 ปีที่แล้ว

    Didnt understand 13th solution

  • @XRWASIFLive
    @XRWASIFLive 2 ปีที่แล้ว

    seem to be possible or straight forward.

  • @Kalllyyy18
    @Kalllyyy18 2 ปีที่แล้ว

    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

  • @SamruddhaShah
    @SamruddhaShah 2 ปีที่แล้ว +1

    Why don't invinite amazon frontend engineeer for interview experience, we will learn alot

  • @Alex-hr2df
    @Alex-hr2df 9 หลายเดือนก่อน

    This is why I HATE JavaScript. It's the only language where you need master its STUPIDITY and FAULTS to pass a job interview 🤦‍♂

    • @RoadsideCoder
      @RoadsideCoder  9 หลายเดือนก่อน

      Its ok bro, high salary is difficult to get.

    • @Alex-hr2df
      @Alex-hr2df 9 หลายเดือนก่อน

      @@RoadsideCoder
      Or rather get the high salary using different techs and languages.

  • @AbhishekKumar-yh6yx
    @AbhishekKumar-yh6yx 5 หลายเดือนก่อน

    The last way of cloning an object is to spread the object not destructure it correctly. Can you please correct me .

    • @RoadsideCoder
      @RoadsideCoder  5 หลายเดือนก่อน

      nope, its to use structuredClone() method

  • @kanchanmatai4170
    @kanchanmatai4170 5 หลายเดือนก่อน

    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.

  • @subhasish_vines
    @subhasish_vines 5 หลายเดือนก่อน

    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 😊

    • @RoadsideCoder
      @RoadsideCoder  5 หลายเดือนก่อน +1

      bhai aap video a speed 0.75x pe krke try kro, better experience hoga

  • @codictive
    @codictive 2 ปีที่แล้ว

    pls make video on storage

  • @avinash15sharma
    @avinash15sharma ปีที่แล้ว

    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.

  • @rams9169
    @rams9169 2 ปีที่แล้ว

    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"
    }

  • @kedarkulkarni0074
    @kedarkulkarni0074 2 ปีที่แล้ว

    Bhai please problem solving ka bhi , sirf list of problems Jo usually FE me puchte hai.

    • @RoadsideCoder
      @RoadsideCoder  2 ปีที่แล้ว +1

      Yes I have planned that too

  • @krish8654
    @krish8654 2 ปีที่แล้ว

    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.

  • @shahzoobgouhar2334
    @shahzoobgouhar2334 ปีที่แล้ว

    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;
    }

  • @CybernaticoByNishant
    @CybernaticoByNishant 2 ปีที่แล้ว

    I like your microphone. Can you give me ?

    • @RoadsideCoder
      @RoadsideCoder  2 ปีที่แล้ว

      Sure, send me ur address 🤓

  • @svanaja331
    @svanaja331 2 หลายเดือนก่อน

    Doing great job

  • @atulraj219
    @atulraj219 8 หลายเดือนก่อน

    Bro is obsessed with 69 😂

  • @rahulrathod8959
    @rahulrathod8959 2 ปีที่แล้ว

    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?

  • @adnantariq3346
    @adnantariq3346 ปีที่แล้ว

    5:38 Trying to loop through an object will NOT work in react. it will give "'key' is not defined"

  • @instinct_gallant8694
    @instinct_gallant8694 2 ปีที่แล้ว

    TNice tutorials tutorial was worth it, I understood everytNice tutorialng now

  • @nishantshah_
    @nishantshah_ 2 ปีที่แล้ว

    Object.assign and destructuring creates shallow copy only.

  • @karthikkonathala3002
    @karthikkonathala3002 2 ปีที่แล้ว +1

    Yes, please make a video on differences between session storage, local storage and cookies when and how to use them

  • @ShubhamPatil-rr4on
    @ShubhamPatil-rr4on 2 ปีที่แล้ว +1

    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

    • @RoadsideCoder
      @RoadsideCoder  2 ปีที่แล้ว +2

      Oh wow bro, can u provide me the timestamp of that video where he said that?

    • @BrijeshSingh-dp1ku
      @BrijeshSingh-dp1ku 2 ปีที่แล้ว

      @@RoadsideCoder 32.25

    • @ShubhamPatil-rr4on
      @ShubhamPatil-rr4on 2 ปีที่แล้ว

      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.

    • @RoadsideCoder
      @RoadsideCoder  2 ปีที่แล้ว

      @@ShubhamPatil-rr4on Sure

  • @ranajoyghosh1008
    @ranajoyghosh1008 2 ปีที่แล้ว

    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.

  • @ajitshaw1936
    @ajitshaw1936 2 ปีที่แล้ว

    +1

  • @kitchen-e-kausar9105
    @kitchen-e-kausar9105 ปีที่แล้ว

    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.

  • @umairahmedofficial1
    @umairahmedofficial1 2 ปีที่แล้ว

    Sath sath JSON bhi bata dete...

  • @himanshupandey3451
    @himanshupandey3451 2 ปีที่แล้ว

    great big fan now

  • @amanmalhotra8730
    @amanmalhotra8730 8 หลายเดือนก่อน

    awesome ❤❤

  • @gilvinjose570
    @gilvinjose570 2 ปีที่แล้ว

    that marijuana

  • @jhaganb9215
    @jhaganb9215 2 ปีที่แล้ว

    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 :)

  • @ιυ_αα-ξ5σ
    @ιυ_αα-ξ5σ 2 ปีที่แล้ว

    Sa here...lol

  • @nishachapte7
    @nishachapte7 2 ปีที่แล้ว

    Thanks..Amazing and very useful video.

  • @SalmanKhan-lx9kp
    @SalmanKhan-lx9kp 2 ปีที่แล้ว +1

    waiting 🔥

  • @VishalSharma-rn7mt
    @VishalSharma-rn7mt 10 หลายเดือนก่อน

    Awesome

  • @ayushrastogi_
    @ayushrastogi_ 11 หลายเดือนก่อน

    Please create a video on interview questions asked about Local Storage and Sessions Storage.

  • @andrei-gabrieldragomir
    @andrei-gabrieldragomir ปีที่แล้ว

    good

  • @sanketthakre7375
    @sanketthakre7375 4 หลายเดือนก่อน

    Brother please be quite slow. You are way too fast.

    • @RoadsideCoder
      @RoadsideCoder  4 หลายเดือนก่อน

      you can change the speed of the video to 0.75x

  • @hareshdhanani2073
    @hareshdhanani2073 2 ปีที่แล้ว

    Thanks.

  • @MrK-nb7xr
    @MrK-nb7xr 2 ปีที่แล้ว

    Please make on cookies , local storage, session related stuff every things
    ..
    Thanks

  • @smordefx7688
    @smordefx7688 2 ปีที่แล้ว

    works great and without any problems

  • @keshavgaur1886
    @keshavgaur1886 2 ปีที่แล้ว

    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

  • @rakaa31
    @rakaa31 2 ปีที่แล้ว

    please make a video on How much javascript is enough for interviews and what are the important topics to focus on for interviews

  • @cloud9656
    @cloud9656 ปีที่แล้ว

    Please create more videos for this playlist.
    Thanks

  • @xync1252
    @xync1252 2 ปีที่แล้ว

    Please make portfolio video egarlu waiting...

  • @tpadma7419
    @tpadma7419 5 หลายเดือนก่อน

    100% interview preparation..........very very thankfull...waiting for more such videos.....

    • @RoadsideCoder
      @RoadsideCoder  5 หลายเดือนก่อน +1

      Checkout the full course here - roadsidecoder.com/course-details

  • @santhoshkashyap9405
    @santhoshkashyap9405 2 ปีที่แล้ว

    Javascript is really super weird man

  • @abdelrahmanelsaadany892
    @abdelrahmanelsaadany892 2 ปีที่แล้ว

    I didn't know this video existed! Thanks bro! Really grateful.

  • @princeverma6533
    @princeverma6533 2 ปีที่แล้ว

    Great Video, Please make video on cookie, session and local storage with examples

  • @juniorWeb247
    @juniorWeb247 ปีที่แล้ว

    Really really help to me, thank you much brother. You are really doing a good job. God bless you, man.

  • @saikatbose2410
    @saikatbose2410 2 ปีที่แล้ว

    Please make the video on local storage, session storage, cache and cookies etc