Skip to content

Tag: object

The difference in syntax for updating an object item

What is the difference between: and Answer The first is an assignment to cartItem, while the second is a mutation of the object held by cartItem. The first creates a new object. The previous value of cartItem referenced an object that could still be referenced by another reference. Demo: So there is a differe…

how to insert deep in object

I have this object with tables: An I would like to insert dynamicly a new table. I tried this: But it overwrites my exsiting entrances. This will also not work: How this will work? Answer For a more reusable solution, take a look at this SO question – you want to deep merge the new object with the old o…