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 trialElizabeth Kramer
7,154 PointsI have no idea why this is not passing. I've checked all the commas and other notations in this challenge.
var objects = [ { organization: "Center for Women and Families", volunteer: yes }, { organization: "Bank of America", volunteer: no }, { organization: "Habitat for Humanity", volunteer: yes } ];
var objects = [
{
organization: "Center for Women and Families",
volunteer: yes
},
{
organization: "Bank of America",
volunteer: no
},
{
organization: "Habitat for Humanity",
volunteer: yes
}
];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
4 Answers
Steven Parker
231,269 PointsYou're really close! You just forgot to enclose your "yes" and "no" values in quotes.
Another solution that would also work would be to replace them with true and false (then no quotes needed).
Jennifer Nordell
Treehouse TeacherHi there! I feel like you're doing great and you're correct that your commas and brackets etcetera are all correct. The problem here lies in the use of yes
and no
. These words by themselves mean nothing to JavaScript. It thinks you're trying to reference variables named "yes" and "no".
Take a look at the Bummer! message:
Bummer! There was an error with your code: ReferenceError: Can't find variable: yes
See? It thinks yes
is a variable. You can fix this one of two ways. You can either turn yes into a string by putting quotes around it, or you can use the boolean values true
or false
.
So either:
volunteer: "yes"
Or:
volunteer: true
I feel like the latter one is closer to what you're wanting. Hope this helps!
Elizabeth Kramer
7,154 PointsThanks!
Elizabeth Kramer
7,154 PointsThanks.