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 trialAna Larrea
1,635 PointsInside the challenge: Create an array of objects im getting error in task 2!
I get the message: Task 1 is no longer passing, when task 1 is just creating an empty array. Task two says this: Inside the array literal, add three object literals. In other words, the objects array should have three values. Each object should have 2 property/value pairs. What I am doing wrong? find my code attached. Thanks!
var objects = [ { name: "You can do it" assignedTo: "Ana" }, { name: "You are the best", assignedTo: "Also Ana" }, { name: "Great coding skills", assignedTo: "Ana, of course" } ];
3 Answers
Ana Larrea
1,635 PointsThat was it! Thank you so much :)
Peter Lawless
24,404 PointsI think you're just missing the comma separating the two property/value pairs in your first object!
Ana Larrea
1,635 PointsThanks, you are right I was missing a ,! However, just changed it and Im still getting an error, (Task 1 is no longer passing) It may be a treehouse error, ?
Peter Lawless
24,404 PointsThat might be a whitespace issue? I copied over your line of code and I see you have padded the ends of the array and objects with a space. When I removed those, the challenge passed. Give that a try.
Hannu Shemeikka
16,799 PointsHi,
I remember I got that same error message but I don't remember why I got it. I any case, I tried that challenge again using your code:
var objects = [
{ name: "You can do it", assignedTo: "Ana" },
{ name: "You are the best", assignedTo: "Also Ana" },
{ name: "Great coding skills", assignedTo: "Ana, of course" }
];
and it works. It might be some threehouse error if your code is exactly like above.
Peter Lawless
24,404 PointsPeter Lawless
24,404 PointsIf hannushemeikka's code worked then it must be the array that is sensitive to whitespace padding, not the objects. I'm new to JS too :)