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

Syntax errors on arrays and objects with properties

Would appreciate some help with the syntax errors that keep arising from this code challenge.

script.js
var objects = [

  {
      name: "Do homework","Do checklist",
      due: "01/27/2016", "02/25/2016",
      assignedTo: "Dave","Darryl"
  },
 {
      name: "Go to gym", "Go to auditorium",
      due: "01/27/2015", "02/03/2015",
      assignedTo: "Cecilia", "Becky"
  },
 {
      name: "Complete JavaScript course", "Complete Web Design",
      due: "05/27/2015", "05/06/2020",
      assignedTo: "You", "Me"
  }


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

2 Answers

Thank you, Dimitarβ€”- understand and successfully completed it!

Dimitar Dimitrov
Dimitar Dimitrov
11,800 Points
var objects = [

  {
      name: "Do homework",
      due: "01/27/2016", 

  },
 {
      name: "Go to gym", 
      due: "01/27/2015", 
  },
 {
      name: "Complete JavaScript course", 
      due: "05/27/2015",
    }
];   

This is how you should do it. The way you did it is wrong because if you want every key to have multiple values like this :

 name: "Go to gym", "Go to auditorium"

you will need to put your values in lets say an array to be able to use them later.

name: ["Do homework", "Do checklist"],