Learn JavaScript
Advanced JavaScript

Arrow Function

An Arrow function provides a compact syntax to create functions. This syntax always creates a function without a name.

Function expression:

The same code written as an arrow function:

In an arrow function, we use curly brackets to enclose multiple lines of code. When we need to return anything from inside the function, then it should have a retrun statement.