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 trialShen JIE LIN
10,612 PointsJavaScript Objects
On 'andrew' and 'ryan', set the 'greet' method as the 'genericGreet' function.
var genericGreet = function() {
return "Hello, my name is " + this.name;
}
var andrew = {
name: "Andrew",
greet: genericGreet.call(andrew)
}
var ryan = {
name: "Ryan",
greet: genericGreet.call(ryan)
}
this does not work
I have also tried just
greet: genericGreet()
greet: genericGreet.apply(ryan)
and it still does not work.
however, it seems to be working in the chrome console window,
someone help figure out why it is not working out in the challenge?
1 Answer
Chris Malcolm
2,909 PointsI think if you remove the parenthesis it worked for me
greet: genericGreet
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsI just tried it, it still doesn't work.
that is pretty weird that it lets you pass but not me then :S
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 Pointsgave it a break, came back, and did the samething again, and it passed, LOL.