“JavaScript: memperbarui properti objek” Kode Jawaban

JavaScript: memperbarui properti objek


var myDog = {
  "name": "Coder",
  "legs": 4,
  "tails": 1,
  "friends": ["freeCodeCamp Campers"]
};

// Update the name value
myDog.name = "Happy Coder";
Outrageous Ocelot

cara mengubah nilai properti objek dalam javascript

myObject.sProp = 'A new string value for our original string property';
Lucky Ladybird

Memperbarui properti objek

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"]);
Owlthegentleman

Jawaban yang mirip dengan “JavaScript: memperbarui properti objek”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya