JavaScript Values Vs References

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

КОМЕНТАРІ • 19

  • @saurabh9446
    @saurabh9446 Рік тому +5

    Need more microservices and more complex stuff 🔥

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

    Is using libraries as lodash really safe ? I have some mutaging problem in development, I prefer solving it with javascript native work around ( spread operator), since lodash is quite heavy and hide the complexity behind mutation. But native solution looks like it is not powerfull enough to deal with deeply nested object with a objects and arrays. Is there someone here who could have a suggestion ? ( JSON.parse(JSON.stringify(object)) works but it's not optimized for memory and my typeScript refuse the use of structuredClone().
    Thx for all your videos, just to let you know, I built my rest API on your fastify videos ;-)

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

      Yeah of course using lodash is safe. Why would it not be?
      JSON.parse(JSON.stringify(object)) should be avoided because it doesn't copy some properties such as symbol, functions or undefined.

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

    2:10 I thought he said "and this is where we can run into some dogshit" 🤣😂 had to watch it back to realise he said "gotchas"

  • @SonyaSakayev
    @SonyaSakayev 6 місяців тому +1

    Thank you for the thorough explanation!

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

    Whoa

  • @nikman5541
    @nikman5541 9 місяців тому

    Just use JSON object methods like parse( ) and stringify( ) or use newly added structuredClone( ) function

  • @Felipe-53
    @Felipe-53 Рік тому +2

    Really like your way of explaining things. Very thorough. Keep it coming and thanks!

  • @Felipe-53
    @Felipe-53 Рік тому +1

    I actually like revisiting the fundamentals

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

    really great explanation, thanks Tom

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

    Wow! Amazing with lodash!

  • @Lucas-gt8en
    @Lucas-gt8en Рік тому

    This stuff gets really nasty when you’re dealing with objects within objects and I’m yet to find an elegant solution. Anyone have any suggestions?

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

      Do you have an example? Happy to take a look

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

      @@TomDoesTech Easy to fix, but I wrote something like this recently `const myArray = new Array(10).fill(new Array(10).fill(0))`

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

      const obj2 = JSON.parse( JSON.stringify( obj1 ) )

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

      @@TomDoesTech MyObject = {status : true, AllUsers: [{name:"jhone", credentials: ["home", "editUser"] } , {name:"Tom", credentials: ["home", "library"] } ] } . How can we change MyObject.AllUsers[0].credentials[1] from "editUser" to "editAdmin" (all values are faked, is just to illustrate the difficulty to use newObject = {...MyObject, AllUsers : {...AllUser , ...AndSoOn I'm quite stuck to that point to be honest. I use React-Query, so nested Object are legions and mutaging through the app really tricky

  • @Felipe-53
    @Felipe-53 Рік тому

    Curious to what techonology did you use to generate such beatiful slides