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 Object-Oriented JavaScript Working with Classes in JavaScript Adding Methods To Our Class

can you add any method title?

instead of " speak() "

Can we name it anything else other than speak and still work?

1 Answer

Bella Bradbury
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Bella Bradbury
Front End Web Development Techdegree Graduate 32,790 Points

Peter,

Yes! But it is still important to name the object method something that makes sense. There are the custom methods that you create, but you do have to name them as well as clarify what they are supposed to do when called. There are also built-in methods that are pre-defined so all you need to do is call the already established name.

Here's a link to the JavaScript Object Methods on w3schools which goes over and gives examples for:

  • The this keyword
  • JavaScript methods
  • Accessing object methods
  • Adding a method to an object
  • Using built in methods

Happy coding!

Thank you so much! I love it when you respond to the answers because you always go above and beyond from the explanation. Very helpful. Thank you!