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 trialDamien Williams
865 PointsThis is confusing
I am not sure exactly what to do in this case. It is telling me to set the greet method as the generic greet function. So do I assign the greet method to the generic greet variable?
3 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Damien,
andrew
and ryan
already have a name
property with a name set. The challenge wants you to add the greet
method to both and set it to the genericGreet
function
var andrew = {
name: "Andrew",
greet: // set the generic greet function here
}
var ryan = {
name: "Ryan",
greet: // set the generic greet function here
}
Dustin Matlock
33,856 PointsHi Damien, here is what you should have.
var genericGreet = function () {
return "Hello, my name is " + this.name;
}
var andrew = {
name: "Andrew",
greet: genericGreet
}
var ryan = {
name: "Ryan",
greet: genericGreet
}
Damien Williams
865 PointsThanks guys. I was able to figure it out. Thanks for your reply.