--- id: 56bbb991ad1ed5201cd392d2 title: Add New Properties to a JavaScript Object challengeType: 1 videoUrl: 'https://scrimba.com/c/cQe38UD' forumTopicId: 301169 --- ## Description
You can add new properties to existing JavaScript objects the same way you would modify them. Here's how we would add a "bark" property to ourDog: ourDog.bark = "bow-wow"; or ourDog["bark"] = "bow-wow"; Now when we evaluate ourDog.bark, we'll get his bark, "bow-wow".
## Instructions
Add a "bark" property to myDog and set it to a dog sound, such as "woof". You may use either dot or bracket notation.
## Tests
```yml tests: - text: Add the property "bark" to myDog. testString: assert(myDog.bark !== undefined); - text: Do not add "bark" to the setup section testString: assert(!/bark[^\n]:/.test(code)); ```
## Challenge Seed
```js // Example var ourDog = { "name": "Camper", "legs": 4, "tails": 1, "friends": ["everything!"] }; ourDog.bark = "bow-wow"; // Setup var myDog = { "name": "Happy Coder", "legs": 4, "tails": 1, "friends": ["freeCodeCamp Campers"] }; // Only change code below this line. ```
### After Test
```js (function(z){return z;})(myDog); ```
## Solution
```js var myDog = { "name": "Happy Coder", "legs": 4, "tails": 1, "friends": ["freeCodeCamp Campers"] }; myDog.bark = "Woof Woof"; ```