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 Loops, Arrays and Objects Tracking Data Using Objects Create an Array of Objects

Is this a bug in the code challenge?

Here is the question:

"Inside the array literal, add three object literals. In other words, the objects array should have three values. Each object should have 2 property/value pairs."

This is my code, and it's giving me an error, but I'm not sure why. Any thoughts?

var object = [
      name: "Megan",
      hometown: "Lancaster",
      name: "Michael",
      hometown: "Atlanta",
      name: "Luis",
      hometown: "Monterrey",

1 Answer

Steven Ang
Steven Ang
41,751 Points

First off, the challenge wants you have a variable named objects not object - plural not singular. Second, you do not need to add a comma after the last item in the object, it just redundant because there's no more item after that. Finally, there is unexpected back tick after the semi-colon, please remove that. Once you've done all of that, you will pass the challenge.

How did I not see those extra commas! Thanks for the help :)