Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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