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

Need assistance with JS Foundation > Objects > Methods (objective)

I've been stuck on this question, and topic of methods all day. I hardly understand the question, and have tried multiple methods in the console to see what results I would get that with those methods. Still, I can't figure it out. If you could help me, without giving the exact answer, I'd greatly appreciate it. http://gyazo.com/2cbf819095a3ed44aad7f08e8a054cdb

3 Answers

I found a forum post that pertains to your problem. The user explains the process nicely. https://teamtreehouse.com/forum/javascript-methods-help-on-andrew-and-ryan-set-the-greet-method-as-the-genericgreet-function

//

What the user does not explain is how to display their names afterwards which is like this:

ryan.greet();

Sorry if these were not quite helpful. I thought at first that I knew Methods, but I had forgotten some aspects.

Thanks for all the help! It really helped a lot. It was actually a lot simpler than I though. I think the problem was that I assumed the structure: keyName : function(){} is the same as saying function keyName(){} and assumed it could be called up on using: object.keyName(); and that would be represent my function (in relation to the first example)

Edit: I actually originally had the right answer. I just forgot my commas!

Anyways, thanks for all your help. I feel a lot more confident with using methods after seeing that post.

No problem, glad to help. :)