JS: Objects
Theory: Modifications
We use assignment to both create and update property values in objects. For non-existing properties, it'll write a new element, for existing properties, it'll overwrite it with the new value:
Even though the object is declared as a constant, it can change. The reason for this behavior is exactly the same as with arrays. It is not the object itself that is stored in the constant, but a reference to it. This means that you can change the object, but you cannot replace the object with another one:
You can learn more about this in a future lesson.
Objects being changeable means you can change them step by step. I.e., we can create an empty object and then add to it the desired properties:
You can delete an element from an object using the delete operator:
Despite the existence of the delete operator, it's bad practice to remove properties from an object. As you'll see later, any problem can be solved without deleting things and, more importantly, code without a delete operator is better.

