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 trialSasha Ewan
3,457 PointsDon't understand why I can't pass task 2 of this challenge
I'm supposed to assign my name to the fullName property, but when I submit it just keeps saying Task 1 is no longer passing. I don't know what the error is.
var contact = {
fullName = "Stacy Wi";
};
3 Answers
Josh Haywood
5,621 PointsYou need to leave out the semicolon inside your object constructor. If you had more properties to define, you would use a comma, but the last property would not have any punctuation after except for the closing curly brace. You're looking for
var contact = {
fullName: "Stacy Wi"
};
Sasha Ewan
3,457 Pointsthank you
Jason Anders
Treehouse Moderator 145,860 PointsHi Sasha, The first part of the challenge wants you to create an object literal with no properties to the variable contact, which you did right. The 2nd part wants you to assign your name to the 'fullName' variable in the object literal. But since the object literal is empty, you need to assign the variable and the value together. So your code will look like this:
var contact = {};
contact.fullName = "Sasha";
Hopefully that makes sense to you. If not, please let the me know. Jason :)
Irfan Hussain
Courses Plus Student 6,593 PointsWhy did u repeat object its already assign.
fullName: "Sasha"
Ary de Oliveira
28,298 Pointsvar contact = { fullName: "Ary de Oliveira" };
Sasha Ewan
3,457 PointsSasha Ewan
3,457 Pointsalso in posting, my colon was somehow turned into an equal sign. The code i'm actually submitting is:
var contact = { fullName : "Stacy Will"; };
But it won't let me pass.