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 Asynchronous Programming with JavaScript Asynchronous JavaScript with Callbacks Callbacks Review

2,885 Points

I don't understand why (sum) is used.

The function add is asking for 3 arguments one of those being a function. I understand that much... What I do not get is when the add function is invoked the function being passed as the third argument has an argument of sum...?

Reggie Williams
Reggie Williams
Treehouse Teacher

Hey italiandadx2 ! function(sum) is the third argument. The function has the argument of sum because it's anonymous and doesn't have another definition. Because we see sum as an argument of the function we know that the value passed in will be passed as well in place of the word sum inside the function