Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Add New Properties to a JavaScript Object

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

myDog.bark = "woof";
// or
myDog["bark"] = "woof";
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Add #New #Properties #JavaScript #Object
ADD COMMENT
Topic
Name
4+7 =