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 trialDavid Dehghani
6,992 PointsObject basics in JS help.
I feel like I'm close to grasping the concept of objects but I can't figure out what seems to be an easy question.
var contact = {
firstName: "Andrew",
lastName: "Chalkley",
fullName: function() {
this[firstName] + " " + this[lastName]
};
return fullName;
}
john larson
16,594 PointsI just noticed you have the return for the fullName method outside that function. Maybe it will pass if you make that small change
fullName: function() {
this[firstName] + " " + this[lastName]
return fullName;
};
john larson
16,594 Points:D
1 Answer
john larson
16,594 Pointsvar contact = {
firstName: "Andrew",
lastName: "Chalkley",
fullName: function(){
return this.firstName + " " + this.lastName;
}
}
David Dehghani
6,992 PointsI was so close. The syntax is JS is so tight, I'm always feeling like I'll miss something small. Thanks for the help!
john larson
16,594 Pointsjohn larson
16,594 PointsDavid, Hi. I see what you did and it looks like it should pass the challenge, but apparently not. I posted what passed for me. It's almost identical to yours