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

JavaScript

Methods 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.

I figured it out, this can be closed/removed

4 Answers

I'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 (,).

Seriously! I had this right the very first time and missed the commas. Fast forward about 35 minutes and BAM!

Yaron Attar
Yaron Attar
9,738 Points

i am stuck with the same problem, for the last 2 days.. still getting null error.. please save me from going insane..:-) thanks - Yaron.

Oh 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
Yaron Attar
9,738 Points

thanks 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.

hey guys, I have the same issue, I keep getting null,

I thought greet: genericGreet would work, please help!!!