Objects are flexible. You can change them any time, even if they were created with const (remember: const locks the variable, not the contents).
const pet = { name: "Bingo", species: "dog" };
// change a property
pet.name = "Bingo the Brave";
// add brand new properties
pet.age = 4;
pet["favorite toy"] = "old slipper";
// delete a property
delete pet.species;
console.log(pet);
It prints
{ name: 'Bingo the Brave', age: 4, 'favorite toy': 'old slipper' }If you assign to a property that exists, it gets updated. If it doesn't exist yet, it gets created. And delete removes a property completely.
Checking if a property exists
To check whether an object has a certain property, use the in operator:
const pet = { name: "Bingo", age: 4 };
console.log("name" in pet);
console.log("color" in pet);
It prints
true false