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!
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
SH Ding3,125 Points
At 6:30 in this video, what is the difference between calling decrementScore and decrementScore().
What is the difference between each of the two and what it does? When would you choose one over the other?
Steven Parker228,025 Points
When you use just the name of a method as an argument, you are passing a reference to the function itself. This is often referred to as a "callback". The function is not called by making this reference.
When you put parentheses after a method name, with or without arguments inside, you are calling the function, and what you pass as the argument is whatever the function returns when it finishes running.
Which one of these you would use is determined by the argument requirements of the function you are passing it to, and possibly also by what the function returns.