DEV Community

Cover image for ES6 Arrow Functions

ES6 Arrow Functions

Meggie on February 20, 2019

They are next-generation JavaScript syntax for creating functions. Normal JavaScript function syntax: function myFunc() { ... } ES6 fat ...
Collapse
 
raddevus profile image
raddevus

Nice article.

Here's maybe the main reason to implement an arrow function => Ability to define the function at the same place it is called.
This creates a good shortcut because there are many times when you have to pass a function to a method and instead of moving to another section in your code and typing up the function definition and then coming back to that place where you will call the function, you can simply define and call the function in the same location in your code.

Makes Code More Readable / Discovering Intent

This can also make the code easier to read because a reader of the code (who is attempting to determine what the code does) doesn't have to slide down to the function definition (away from the place where it is called) -- but can instead simply read what the function does right at the same place where it is called.

Collapse
 
thepracticaldev profile image
dev.to staff

Nice concise overview.

Collapse
 
hellomeghna profile image
Meggie • Edited

Thank you! I'll keep sharing my tidbits here.
I loved the markdown editor on this platform!

Collapse
 
afewminutesofcode profile image
Aaron

Thanks for sharing Meggie! I was thinking the same thing the markdown editor is amazing!

Collapse
 
pawan profile image
Pawan Mall

Using it lot of time in my code and it is really a time saviour