Это видео недоступно.
Сожалеем об этом.

Deep Copy vs Shallow Copy | Javascript Interview questions and answers in hindi

Поделиться
HTML-код
  • Опубликовано: 14 авг 2024
  • Wondering the difference between Deep Copy and Shallow copy or how to deep copy objects in javascript and it was very import to understand this in depth about shallow copy, ways to shallow copy, deep copy and the best way to deep copy.
    I have tried to cover all these methods in this video which will help you to understand this concept in depthWe will also see what happens behind the scenes in the browser when you use them in code.
    Good Luck,
    Sofia Goyal
    If you like my work you can support me and buy me a coffee at:
    buy.stripe.com...
    00:00 - Introduction
    00:44 - Normal copy
    02:24 - Shallow Copy
    03:36 - Issues with shallow copy
    05:52 - Deep copy
    07:00 - issue with json stringify and parse
    09:49 - using lodash
    11:12 - Thank you for watching 🙏
    My Nagarro interview experience:
    • Nagarro Interview Expe...
    How I got a job in germany
    • How To Get a Job in Ge...
    Javascript interview questions series:
    • Javascript Interview Q...
    - If you are looking for resume making tips, please checkout :
    • How to Make a Resume |...
    - If you are willing to become a web developer, check this out :
    • How to become a Web De...
    - For other interview tips and job change tips:
    • how to get job during ...
    • how to prepare for an ...
    • interview tips and tec...
    I will keep making these tutorials and will try to put my best into this so that i can provide you with the most relevant content.
    Please keep supporting and if you like it please share with your friends.
    Stay Connected:
    Linkedin : / sofia-goyal
    Facebook : / sofigoyal14
    Instagram : / sofi_goyal
    Twitter : / sofiagoyal14
    #JavaScriptInterviewQuestions #JavaScriptInterviewQuestionsandanswers #JavaScriptTutorial #sofiagoyal #mostaskedinterviewquestions #deepcopyvsshallowcopy #sofiagoyal

Комментарии • 54

  • @NKG_Creations
    @NKG_Creations 16 дней назад

    Thank you very much😄

  • @sagarmahey
    @sagarmahey 2 месяца назад

    love your work you just make it very simple and clear that too with giving each and every exact tiny detail ,may godbless you❤️

  • @Muhammad-Ahmer.
    @Muhammad-Ahmer. 4 месяца назад

    ZABARDAST ... CONTINUE RAKHIEN APNAY LECTURES ...

  • @rishabhpratapsingh5304
    @rishabhpratapsingh5304 Год назад

    Taught us in a very nice manner and not consumed lot of time.........

  • @shwetamishra8992
    @shwetamishra8992 11 месяцев назад

    Nice explanation now I am clearing my all doubts.

  • @janiirigi907
    @janiirigi907 2 года назад +1

    Good one... Appreciate the explanation.. I'm ready to face this question now😎

  • @Harshitbadolla
    @Harshitbadolla 2 года назад +3

    I didn't know that the function won't get copied using stringify. Thanks for pointing that out and here is the solution to the homework problem
    let person = {
    firstName: "Harshit",
    lastName: "Badolla",
    fullName(){
    return `${this.firstName} is ${this.lastName}`;
    }
    };
    let keys = Object.keys(person);
    function deepCopy(arr) {
    const newObj = {}
    for(let i = 0; i

    • @SofiaGoyal
      @SofiaGoyal  2 года назад +1

      Superb yr...keep going... 👍

    • @Harshitbadolla
      @Harshitbadolla 2 года назад

      We can improve the solution by passing an object as an argument and moving the keys variable inside the function deepcopy...this way it will become more like the lodash method which you used in the video. Let me know what you think? Also lodash method will check for all corner cases but the function which i wrote can also be used.

    • @Harshitbadolla
      @Harshitbadolla 2 года назад

      let person = {
      firstName: "Harshit",
      lastName: "Badolla",
      fullName(){
      return `${this.firstName} is ${this.lastName}`;
      }
      };
      function deepCopy(obj) {
      let keys = Object.keys(person);
      const newObj = {}
      for(let i = 0; i

    • @namratagiri4240
      @namratagiri4240 2 года назад

      @@Harshitbadolla this is still the shallow copy not deep copy..
      Try with below obj
      let person = {
      firstName: "Harshit",
      lastName: "Badolla",
      address: {
      location: 'Pune',
      hometown: 'Mumbai'
      },
      fullName(){
      return `${this.firstName} is ${this.lastName}`;
      }
      };
      If we change address.location for one object it gets changed for another object too.
      @sofia Can you suggest how we can make it deepcopy (and make it work for nested objs too)?
      [I am also trying, will post here if I find soln]

    • @Harshitbadolla
      @Harshitbadolla 2 года назад +1

      @@namratagiri4240
      const deepCopyFunction = (inObject) => {
      let outObject, value, key
      if (typeof inObject !== "object" || inObject === null) {
      return inObject // Return the value if inObject is not an object
      }
      // Create an array or object to hold the values
      outObject = Array.isArray(inObject) ? [] : {}
      for (key in inObject) {
      value = inObject[key]
      // Recursively (deep) copy for nested objects, including arrays
      outObject[key] = deepCopyFunction(value)
      }
      return outObject
      };
      I got the above solution from here -
      javascript.plainenglish.io/how-to-deep-copy-objects-and-arrays-in-javascript-7c911359b089
      Thanks for pointing out...I got to learn something new.
      Also it is always best to use a library to deep copy like lodash as there will be lot of corner cases which needs to be taken care of. All the best 👍

  • @SAMEERKHAN-nd7ti
    @SAMEERKHAN-nd7ti 2 года назад

    simply excellent....

  • @gauravpise6393
    @gauravpise6393 Год назад

    You are a great teacher. I have started to see you js playlist. it is very good.

    • @SofiaGoyal
      @SofiaGoyal  Год назад +1

      Thanks 🙏 react tutorials are also coming soon if you are interested

  • @sarimali1584
    @sarimali1584 11 месяцев назад

    hi...
    very informative .

  • @notappi3982
    @notappi3982 Год назад

    beauty with knowledge killer combo thanks a lot

  • @rahulwadile4785
    @rahulwadile4785 Год назад

    so knowledgeable

  • @BooksBelievers09
    @BooksBelievers09 2 года назад

    Awesome explanation 🙂.

  • @whitecodecamp
    @whitecodecamp 2 года назад

    Knowledgeable Content👍

  • @shubhampawar732
    @shubhampawar732 Год назад

    Well Explained...

  • @ShivamSharma-uc8pu
    @ShivamSharma-uc8pu 2 года назад +1

    Good one, I would like to see concept of functional programming in js like HOC with prons and cons and closures with prons and cons.

    • @SofiaGoyal
      @SofiaGoyal  2 года назад

      Coming up with closures soon...

  • @ghulammehdisoomro7980
    @ghulammehdisoomro7980 2 года назад

    great information for new man job interview

  • @chinmayganjiwale6499
    @chinmayganjiwale6499 Год назад

    Thanks a lot

  • @AmitKumar-gg5gj
    @AmitKumar-gg5gj 2 года назад

    Wonderfully explained. 👍

  • @amitpaple
    @amitpaple 2 года назад

    Thanks alot 👍

  • @nilesh906
    @nilesh906 Год назад

    Nice 👌

  • @adityatrivedi4820
    @adityatrivedi4820 2 года назад +1

    Mam , I have started learning JavaScript, CSS and HTML from 2 months...from online resources... Please tell me when can I get a job as frontend developer

    • @SofiaGoyal
      @SofiaGoyal  2 года назад

      Honestly there is no certain answer to this.. It completely depends on your grasping power... But i am sure that if you keep learning and practicing you will get a job soon... All the best.. 👍

    • @adityatrivedi4820
      @adityatrivedi4820 2 года назад

      @@SofiaGoyal thanks mam..could u guide me for getting a starting job as Front end developer.. what should i do more to get job ASAP..

  • @jagdishjena9058
    @jagdishjena9058 2 года назад

    Mam ap esse hi videos laya kijiye so that we can crack the interview

    • @SofiaGoyal
      @SofiaGoyal  2 года назад +1

      Sure... Working on more... 😊

  • @kanikaagarwal3159
    @kanikaagarwal3159 2 года назад

    Hi mam,
    I am giving the interview in front end how can I practice tricky js question.

    • @SofiaGoyal
      @SofiaGoyal  2 года назад +1

      I think you need to know js in depth, then you will be able to solve them all

  • @rehanhaq3564
    @rehanhaq3564 2 года назад

    please pick all the topics to js ...

  • @wememeslover2548
    @wememeslover2548 Год назад

    Mam mera error a raha Uncaught TypeError: JSON.stringfy is not a function

    • @AjayChauhan-dg2nl
      @AjayChauhan-dg2nl Год назад

      stringify ki spelling yaha galat hai to program m bh hogi

  • @deepakgupta2084
    @deepakgupta2084 2 года назад

    Mam Event loop Javascript ka video bna do kafi puchte hai interview mai pr actual mai niii pta

    • @SofiaGoyal
      @SofiaGoyal  2 года назад +1

      Sure... Will Come with that soon...

  • @jagdishjena9058
    @jagdishjena9058 2 года назад

    mam object.seeze and object.freez par video banaea.

    • @SofiaGoyal
      @SofiaGoyal  2 года назад

      Sure.. Will try

    • @jagdishjena9058
      @jagdishjena9058 2 года назад

      @@SofiaGoyal mam sorry it is Object.freeze vs Object.seal ess par videos banaea.

  • @jagdishjena9058
    @jagdishjena9058 2 года назад

    mam clone deep nahi mill raha extention me.

    • @SofiaGoyal
      @SofiaGoyal  2 года назад

      You need to have lodash added to your project... Clonedeep is a method of lodash...
      www.google.com/amp/s/www.geeksforgeeks.org/lodash-_-clonedeep-method/amp/

  • @dominic9714
    @dominic9714 Год назад

    Ye concept koye java mai bhi bta do:(

  • @kewalkandpal
    @kewalkandpal 2 года назад

    Thanks a lot