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 trialjames mchugh
6,234 PointsSyntax error
I'm really not sure what I'm suppose to do here
var objects = [
{
"name":"Joe",
"age":19,
"city":"LA"
}
];
['cities', NY, LA]
];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
Charlie Harcourt
8,046 PointsYou seem to have code right at the bottom of your work space that doesn't look very necessary? Try taking away that code and if not try something like this code below BUT NOT THIS DON'T COPY :D
var objects = [
{
"animal":"Dog",
"breed":Boston
}
];
:)
John Lack-Wilson
8,181 PointsHi James, did you manage to resolve this?
If not, here's what looks to be going wrong:
- Theres a stray '];' at the very end of the js file
- NY and LA are not in quotes, and thus will be treated as variables, so you should either define them as variables or put quotes around them
Charlie Harcourt
8,046 PointsCharlie Harcourt
8,046 PointsYes just tried out your code without that stuff at the bottom and it works fine. Did you forget to remove it? :P
james mchugh
6,234 Pointsjames mchugh
6,234 PointsYeah I',m not sure why that is there. I think it's from an earlier attempt and it never got deleted. I posted a new attempt , but I'm getting a syntax error message.