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

I am getting this question wrong even though I looked into the video many times. Can someone please help.

The hint is saying that task 1 is no longer passing

script.js
var objects = [

{name: "Bob"
   age: 14},

  {name: "Sally"
  age: 15},

  {name: "Phil"
  age: 13},

]
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

3 Answers

Your code is almost correct, you are just missing the commas in between the values inside each object and the semi colon at the end of the array, like this:

var objects = [

{name: "Bob",
   age: 14},

  {name: "Sally",
  age: 15},

  {name: "Phil",
  age: 13},

];
Shane Oliver
Shane Oliver
19,977 Points

You will need to separate you key value pairs in your objects with commas

var objects = [

{name: "Bob",
   age: 14},

  {name: "Sally",
  age: 15},

  {name: "Phil",
  age: 13},

]

Ohhh. Ok I see it now! Thank you so much.