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 trialPeter Huang
5,427 Pointscan you add any method title?
instead of " speak() "
Can we name it anything else other than speak and still work?
1 Answer
Bella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsPeter,
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!
Peter Huang
5,427 PointsPeter Huang
5,427 PointsThank 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!
Bella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsBella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsThank you! That's very kind of you to say, I'm just happy to help :)