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 trial

Sharon Kearney
8,662 Pointscode challenge help
var contact = { fullName = function printFullName () }
I am reading MDN and W3C and still don't understand.
function printFullName() {
var firstName = "Andrew";
var lastName = "Chalkley";
console.log(firstName + " " + lastName);
}
var contact = {
print = function printFullName () {
}
4 Answers

David Axelrod
36,073 PointsHello Sharon! You're almost there! just move the code for the first function into the print property of the contact object literal!
var contact = {
fullName: function() {
var firstName = "Andrew";
var lastName = "Chalkley";
console.log(firstName + " " + lastName);
}
}

Chyno Deluxe
16,936 Pointsthe challenge is asking that you create a method called fullName that runs the printFullName function. So your code should look like this. View Below
function printFullName() {
var firstName = "Andrew";
var lastName = "Chalkley";
console.log(firstName + " " + lastName);
}
var contact = {
fullName: printFullName
}
i hope this helps

David Axelrod
36,073 PointsHey Chyno! I thought the same thing too! problem is that it doesnt pass the second part of the code challenge :( I think they're really trying to cement the idea of anonymous functions

Chyno Deluxe
16,936 Pointsoh. ok I didn't go that far. I'll check it out right now and see how I can help if David's answer doesn't work.

Sharon Kearney
8,662 Pointsthank you for your help.

Ary de Oliveira
Courses Plus Student 28,304 Pointsvar contact = { fullName: function() { var firstName = "Andrew"; var lastName = "Chalkley"; console.log(firstName + " " + lastName); } }
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 PointsDavid's answer is correct.