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

Arthur Kakulidis
Arthur Kakulidis
1,619 Points

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

Connor Walker
Connor Walker
15,007 Points

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,820 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},

]
Arthur Kakulidis
Arthur Kakulidis
1,619 Points

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