JavaScript Node.js Basics Building a Command Line Application Getting the Response Body

David Aguirre
David Aguirre
7,263 Points

FunctionData

Does the function needs to be called data?

1 Answer

Steven Parker
Steven Parker
203,151 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,897 Points

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