JavaScript Node.js Basics Building a Command Line Application Capturing Command Line Arguments

Vincent Wang
Vincent Wang
1,976 Points

Syntax help

I don't understand why we can shorten:

users.forEach( username => { getProfile(username); });

To:

users.forEach(getProfile);

What is happening here that makes these syntaxes the same?

1 Answer

Dario Aubry
Dario Aubry
5,247 Points

Hi Vincent

You can shorten the function because of the new arrow function syntax.

I recommend you to watch this video about arrow functions: https://teamtreehouse.com/library/-basic-arrow-syntax

I hope I helped you.

Dario