JavaScript Node.js Basics Building a Command Line Application Making a GET Request with https

Leo Marco Corpuz
Leo Marco Corpuz
18,975 Points

Response function

I see in the video that the response function has no () before the arrow. Is the () optional?

1 Answer

Mischa Yartsev
Mischa Yartsev
20,490 Points

Hi, Leo Marco Corpuz !

Yes, you're right. If your Arrow function has only one argument like in this case only one argument response than you could omit the brackets.

const request = https.get(`${username}.json`, response => {

Please refer to MDN docs:

or of course Treehouse workshop for more info about Arrow functions: