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 trialJoachim Liedtke
6,690 Points2nd Task won't pass
The second task of this code challenge won't pass. When clicking on Check Work after completing the task, it always says that the first task won't pass anymore, but I haven't changed anything in my code. What is going on here?
var newYork = {
population: 100,
latitude: '40.7127 N',
longitude: '74.0059 W'
};
newYork.population = 8.406e6;
newYork.country = USA;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
3 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Joachim,
Your only issue is that you need to put quotes around USA
so that the browser knows it's a string.
Joachim Liedtke
6,690 PointsOh, yes of course. Thanks. but that failure message is pretty misleading then. 'Cause I didn't change a thing in the line of code that I wrote for the first Task...
Also, I'm having the same issue with the second code challenge.
var objects = [
{'a', 'b'},
{'c', 'd'},
{'e', 'f'}
];
I've got quotes around the strings, I'm using the correct brackets/braces, I'm using commas to separate the objects within the array... I have no clue what's wrong here.
Jason Anello
Courses Plus Student 94,610 PointsGenerally when you get that error message it doesn't mean you did something wrong in a previous task. It happens because when you introduce an error like that in your code, it prevents the previous tasks from passing.
For that one, each object needs to contain 2 property/value pairs. A colon is used to separate each property/value pair.
One way you could it is like this: {a: 3, b: 5}
Jason Anello
Courses Plus Student 94,610 PointsAlso, generally it's recommended to ask a new question when you need help on a different challenge. This makes it easier for others to find the solution in the community who might be stuck on the same problem.
Joachim Liedtke
6,690 PointsThanks. guess I should have read the question more carefully.
Well, I thought it's the same issue, so it would make sense to have it all together in one thread.