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
Casey Clayton
16,708 PointsMethods Code Challange
I am not sure what it is asking me to do here. It says apply the genericGreeting method on 'andrew' and 'ryan' but I keep getting a bummer null error. Not really sure what it even wants me to do. This is the second code challenge in the objects of javascript for the Methods video.
4 Answers
Prabhakar Undurthi
4,846 PointsI've the solution for your problem. It worked for me.
var genericGreet = function() { return "Hello, my name is " + this.name; }
var andrew = { name: "Andrew", greet: genericGreet }
var ryan = { name: "Ryan", greet: genericGreet }
You have to be careful with commas (,).
Chris Ellinger
26,494 PointsSeriously! I had this right the very first time and missed the commas. Fast forward about 35 minutes and BAM!
Yaron Attar
9,738 Pointsi am stuck with the same problem, for the last 2 days.. still getting null error.. please save me from going insane..:-) thanks - Yaron.
Casey Clayton
16,708 PointsOh geez I don't even remember what I did. Can you past the code here and I will see if I can help you out with it.
Yaron Attar
9,738 Pointsthanks for the effort, i did found the problem but as you i dont even remember what it was..:-) again thanks, it is nice to know that you are not alone, have a graet day! Yaron.
Aina Tahiry RATSIMANOHATRA
6,647 Pointshey guys, I have the same issue, I keep getting null,
I thought greet: genericGreet would work, please help!!!
Casey Clayton
16,708 PointsCasey Clayton
16,708 PointsI figured it out, this can be closed/removed