JavaScript JavaScript Objects Object Basics Create an Object

Isaiah Gadson
Isaiah Gadson
5,171 Points

challenge task 1 of 2 declare a variable named addy and assign it an empty object literal.

const person = { name: 'addy' }; I declared my variable, but it's coming back as wrong.What did I do wrong?

2 Answers

Cameron Childres
MOD
Cameron Childres
Treehouse Moderator 11,543 Points

Hi Isaiah,

You've declared a variable named person and assigned it an object with a property of name and a value of 'addy'.

Instead, the challenge wants you to "declare a variable named addy and assign it an empty object literal". To declare addy you would type const addy, and an empty object literal looks just like an empty pair of curly braces: {}. The result looks like this:

const addy = {};

Hope this helps! Let me know if you have any questions.

Isaiah Gadson
Isaiah Gadson
5,171 Points

it works! thanks for the help.