Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Objects Basic Objects

Javascript Objects

Hello,

I am having trouble with the following question. I know it is pretty simple but I am just stuck.

I keep getting the error - Bummer! Was expecting 'me.age' to be a 'number' not 'object'.

Javascript - Objects - Stage 6

Add to the 'me' object a key of "age" and set it to your age, not as a string, but a number.

var me = { name: "jordan", 
                age: ["20"] };

1 Answer

Nevermind, I have solved it myself.

I just needed to change ["20"] to 20

Erik McClintock
Erik McClintock
45,783 Points

Jordan,

That's correct, and great work debugging and fixing it on your own! Keep two things in mind for the future:

  1. When you assign a value to a key using the square brackets [ ], you're saying that you want that key to hold an array inside of it
  2. When you put quotation marks " " around a value, you're declaring it as a string

Happy coding!

Erik