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 trialJorge Cascante
13,582 PointsYou say that to invoke a method is necessary to add () But when you used the method length you didn't use it.
how can I know when the parenthesis are necessary to invoke a method?
4 Answers
Kevin Kenger
32,834 PointsHey Jorge,
Length
is actually a property, not a method. For properties, you don't need to add parenthesis. Think of properties like variables. They hold Information about the object, like its length, for instance. Methods are like functions. They're actions that you can call on an object.
Jorge Cascante
13,582 PointsThanks Kevin. I got confused because it was applied in the video for methods. It makes sense now. I appreciate it.
Kevin Kenger
32,834 PointsNo problem. I actually had a hard time deciphering the difference between the two up until pretty recently. It can be pretty confusing.
Ron L
6,463 PointsAnnnd...one more thanks to Kevin. I was just starting the video and saw Jorge's question and your answer.
Edgar Gil
13,322 PointsThank you Kevin i just finish doing this video and i understood everything, but thank you for making thing clear now i understand it more.