10 Tweets Apr 18, 2023
A brief explanation of the JavaScript ES6 Arrow Function:
— Arrow Functions
Arrow functions is a new feature, it is just a new and cleaner way or syntax of writing JavaScript functions introduced in ES6.
This is the arrow “→“ due to which is called arrow function.
Here is an example:
— Comparison
Let's see the difference b/w the regular and arrow functions:
“Regular Function”:
1/2
“Arrow Function”:
2/2
— Short Syntax
The Syntax of an arrow functions gets shorter if the function has only one statement inside its function body, you can remove {}.
1/2
Other case
If the function has only one statement that returns a value, you can also remove the return keyword.
2/2
— Parameters
Arrow functions can also take parameters. The parameters should be passed inside the parenthesis ()
1/2
Also, if you have only one parameter, you can skip the parenthesis as well ()
2/2
You can get my free JavaScript e-book that has 100+ free resources.
đź”— haiderkh1.gumroad.com
That's a wrap!
If you enjoyed this thread:
1. Follow me @slow_developer for more of these
2. RT the tweet below to share this thread with your audience

Loading suggestions...