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 trialRUPESH BASUDE
2,932 PointsReturning a string
Instead of logging out the full name, modify the code so it returns the string instead. Please help me in this.
var contact = {
firstName: "Andrew",
lastName: "Chalkley",
fullName: function(){
console.log(this.firstName + " " + this.lastName);
var finalName = contact.fullName();
return finalName;
}
}
1 Answer
Tiffany McAllister
25,806 PointsYou don't have to add anything to the code, it's just asking you to modify the existing code. So instead of console.log() you just need to return it like this:
return this.firstName + " " + this.lastName;