Question
I thought using const
meant that the variable can’t be edited. If that’s the case, why can we add key-value pairs and edit them? Wouldn’t we want to use let
instead?
Answer
Remember, the value of a constant can’t be changed through reassignment or redeclared. However, objects are mutable, and in this case, we are altering the object’s contents, not reassigning the object itself.