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 Node.js Basics 2017 Building a Command Line Application Getting the Response Body

FunctionData

Does the function needs to be called data?

1 Answer

Steven Parker
Steven Parker
229,785 Points

I believe you're referring to the callback function passed to "response.on". That is an anonymous function (it has no name), but it takes a parameter named "data" in the video. The parameter name is not important other than it is considered a "best practice" to give parameters names that reflect their purpose. But it would function the same if you changed the parameter name to "bob" or "fish" or any other valid identifier name.

Hubert Odias
Hubert Odias
1,898 Points

Ah so it can be named whatever it wants to be?