From the course: Objects in JavaScript: A Dynamic Data Structure

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Solution: Objects and properties quiz

Solution: Objects and properties quiz

How did the challenge go? Were you able to declare constant variable and assign it to an object? If so, Bravo! Now, I will walk through the solution one step at a time. First, you needed to declare a constant variable using the keyword const and assign it to an object that had the properties with the keys of name, age, and hairstyle. Here is what that could have looked like. We see this on lines one through five. Then you added a property to the object. You could have chosen any label for your key, but for this example, I chose to add the key-value pair a favorite color and the value of purple as seen on line seven. If you were to console dot log objOne, you would see the following on lines nine through 14. How did you do? Were you able to add a property? If you made it through this challenge with no problem, that is great. You are more than ready to move forward to the next chapter. If parts of the challenge or the challenge as a whole seemed overwhelming, it's no problem, and I…

Contents