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

Sonja Tomcic
Sonja Tomcic
6,590 Points

Help. I don't know how to do this

i've tried, but it says task one is no longer passing

script.js
var objects=[


  ];
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

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I really wish I knew what you'd tried that's failing. But likely as not, you had a typo somewhere. When it says task 1 is no longer passing it means that you've introduced a syntax error into your previously working code. Here's what I did:

var objects=[
  {
    name: "Jennifer",
    course: "C#"
  },
  {
    name: "Steven",
    course: "JavaScript"
  },
  {
    name: "Kevin",
    course: "CSS"
  }
  ];

Hope this helps! :sparkles:

Sonja Tomcic
Sonja Tomcic
6,590 Points

Thanks, i didn't put quotation marks. That was the problem

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Sonja Tomcic ah ha! That'll do it, assuming the value is a string. However, if you'd had a key pair like this:

{
  name: "Anne",
  points: 3903
}

then the points wouldn't need quotations as it would be an integer. :smiley: