JavaScript Fundamentals: Merging Objects with Object.assign()

Поділитися
Вставка
  • Опубліковано 14 жов 2024

КОМЕНТАРІ • 11

  • @AlazTetik
    @AlazTetik Рік тому +2

    As always, great summary, thank you!

  • @gunman479
    @gunman479 Рік тому +2

    Very useful. Thanks!
    It's also possible to deep clone using JSON methods like so;
    const deepClonedObj = JSON.parse(JSON.stringify(Object.assign({}, obj)));

  • @batchrocketproject4720
    @batchrocketproject4720 Рік тому

    I really enjoyed this one, thanks. After playing with Object.assign() for a while I can confirm it works perfectly well for arrays (including cloning using newArray = Object.assign([], sourceArray)). You just have to remember array indices are numerical object keys and so equivalent indices are overwritten in the target. Of course it also copies named keys added to the array object and could be quite useful.

  • @imdanteasy
    @imdanteasy Рік тому +1

    👍👍👍

  • @KajalPramanik25
    @KajalPramanik25 Рік тому

    I am following your content on skillshare... But sir why do you remove your content from skillshare? 😢😢😢

    • @AllThingsJavaScript
      @AllThingsJavaScript  Рік тому

      I didn't. Skillshare removed it. It doesn't make any sense to me, so you will need to contact them or go to Udemy. I've stopped updating content on skillshare because I don't know from one moment to the next what they are going to do and it hurts students like you.

  • @dixztube
    @dixztube Рік тому +1

    Ai will end us all!

    • @karthikeyanrajendran3899
      @karthikeyanrajendran3899 Рік тому

      @Rich, You still need to write code to build AI.😂

    • @MrTrucker3000
      @MrTrucker3000 Рік тому +1

      The Ezra Klein Show podcast just released a new episode called, “Why AI Might Not Take Your Job or Supercharge the Economy”, it made me feel a tiny bit better about AI

    • @dixztube
      @dixztube Рік тому

      @@MrTrucker3000 aww I remember I use to listen to him when he was with Vox I truly enjoyed that show before he moved to the times. I’ll have to check it out although that might just be cope lol
      Right now it’s my greatest aide… it’s actually helped in a ton of ways. I even had it play a role as Jung and give me a famed session as his.. I walked away feeling as insightful and clear headed as I ever have.
      It’s so strange this tool. I think it really will replace those of us who are in larger shops but I’m in start up land a place I’ve always enjoyed I think it’ll be less destructive there.