JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects Create an Array of Objects

Mary Mohlenkamp
Mary Mohlenkamp
6,225 Points

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

Mary Mohlenkamp
Mary Mohlenkamp
6,225 Points

Thank you, Dimitar—- understand and successfully completed it!

Dimitar Dimitrov
Dimitar Dimitrov
10,298 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"],