What about if an object contains several values, and only some need to be updated?
I don't want to make extra objects, because I rely on my code editor (Visual Studio Code) to create lists of variables for navigation. It's a very big project so I need to nest variables inside objects. If I have two sets of objects for every concept - one const, another var - that doubles the navigation list and makes it unusable. Not to mention tedious and confusing as I have to jump back and forth between almost identical objects for closely related variables.
You can change the values in an object that you declared with const. When you declare a variable and assign an object to that varaible, you're actually assigning a reference to the object to the variable and not the value itself
Since it isn't a value that's assigned, you can totally do something like this:
Is there a built-in way to pass an object to a variable by value? (Effectively duplicating said object so that when you mutate one, the other remains as it was before?) I understand that you could create a a 2nd object and use a special function to mutate the 2nd object until it matches current version of the 1st object.
-2
u/[deleted] May 04 '20
You guys should make a new more comprehensive chart then. For real, it would be much appreciated!