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

can i get help hare, why this is not correct?

help me please

script.js
var objects = [
  {
    object: 'sale?', 
    answer: 10
}
{
   object: 'roja',
   ansewer: 20
}
{
   object: 'rai',
   answer: 30
}
];
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

1 Answer

luckius kajoka Again really close, you're almost there.

You are missing the commas between each object which is throwing an error in your array.

var objects = [
    {
       object: 'sale?', 
       answer: 10
   }, // added comma
   {
      object: 'roja',
      ansewer: 20
   }, // added comma
   {
      object: 'rai',
      answer: 30
   }
];

hi Ross i did aded comma there but still ,it seem there is a problem can you help me again to check it?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hi luckius kajoka

Once the commas are added the code does pass. Double check your code against the code Ross provided above. I did verify that the code does pass both Tasks in the Challenge.

:) :dizzy: