Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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. :)