update object with new properties code example
Example 1: JavaScript: Updating Object Properties
var myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"]
};
// Update the name value
myDog.name = "Happy Coder";
Example 2: Updating Object Properties
var myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"]
};
myDog.name = "Happy Coder"
console.log(myDog.name);
//or
myDog["name"] = "Happy Coder"
console.log(myDog["name"]);