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 JavaScript Foundations Objects Methods

Objects Methods Challenge Help

Here are my directions:

On 'andrew' and 'ryan', set the 'greet' method as the 'genericGreet' function.

I've tried a few different iterations of what I thought would be correct, but I truly have no clue what I'm doing wrong. Here's what I have now:

<script>

  var genericGreet = function() {
    return "Hello, my name is " + this.name;
  }

  var andrew = {
    name: "Andrew"
    greet: andrew.genericGreet
  }

  var ryan = {
    name: "Ryan"
    greet: ryan.genericGreet
  }



</script>

Thank you in advance!

5 Answers

Steve Leichman. You need to take out ryan and andrew in ryan.genericGreet and remember to put commas after the name. Does that make sense?

I'm new to JS (very) but it looks like you need four semicolons as in the below.

var andrew = {
    name: "Andrew";
    greet: andrew.genericGreet;
  }

  var ryan = {
    name: "Ryan";
    greet: ryan.genericGreet;
  }

Thank you, but that doesn't work. I still get "null" as a result. I've tried a hundred things I thought would be right and I've tried a hundred things out of left field. I'm just stuck on this one.

Ugh. Yes, it does.

Commas.

Stupid, f***ing, commas.

And thank you.