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
Ronnelle Torres
5,958 PointsHelp! Stuck on a challenge
Here's the challenge:
Correct this code so that the greet function returns the expected value.
function Person(name){
this.name = name;
}
Person.prototype.greet = function(otherName){
return "Hi " + otherName + ", my name is " + name;
}
1 Answer
Steven Parker
244,190 PointsWithout the link to the challenge, I can't check this to be sure, but...
It looks like the reference to name is missing a this prefix:
return "Hi " + otherName + ", my name is " + this.name;
Ronnelle Torres
5,958 PointsThanks! :D That worked! :D
Steven Parker
244,190 PointsSteven Parker
244,190 PointsYou forgot to include a link to the challenge itself.