JavaScript: Updating Object Properties
var myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"]
};
// Update the name value
myDog.name = "Happy Coder";
JavaScript: Updating Object Properties
var myDog = {
"name": "Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"]
};
// Update the name value
myDog.name = "Happy Coder";
how to change object property value in javascript
myObject.sProp = 'A new string value for our original string property';
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"]);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us