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 trialmehmet odabas
2,120 Pointsstring error
var contact = { firstName: "Andrew", lastName: "Chalkley", fullName: function(){ var a= String(this.firstName) + String(this.lastName); return a; } }
it says it is expecting return keyword... i didn't understand what it expects i wrote the return keyword inside of the function
var contact = {
firstName: "Andrew",
lastName: "Chalkley",
fullName: function(){
var a= String(this.firstName) + String(this.lastName);
return a;
}
}
2 Answers
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 Pointsvar contact = {
firstName: "Andrew",
lastName: "Chalkley",
fullName: function(){
return this.firstName + " " + this.lastName;
}
}
It says you have to change the console.log statement to return statement.
mehmet odabas
2,120 Pointsi've tried it too i typed this code and didn't work. return this.firstName + this.lastName;
mehmet odabas
2,120 Pointsand your code works. but why mine didn't?
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsWell maybe something went wrong when the data was sent to the checker. Nextime, to save you the nerves -> copy the code you have written -> refresh the page -> paste the code in and check again.