DEV Community

Cover image for JavaScript’s Arrow Functions Explained By Going Down A Slide

JavaScript’s Arrow Functions Explained By Going Down A Slide

Kevin Kononenko on April 20, 2019

If you have been using JavaScript for a few years, you are probably familiar with this syntax: function addTen(num){ return num + 10; }); cons...
Collapse
 
gusgonnet profile image
Gustavo

this is great, amusing and easy to understand!
I now see slides all over my code :)
love it

Collapse
 
kbk0125 profile image
Kevin Kononenko

Thanks Gustavo :)

Collapse
 
misterbrash profile image
MisterBrash

Maybe I read it too fast or I'm too tired but I don't see where you explain why there's no return keyword in your first arrow function example...

Collapse
 
dirkkiesewetter profile image
Dirk Kiesewetter

Arrow functions can have implicit returns: dev.to/samanthaming/es6-arrow-func...

Collapse
 
misterbrash profile image
MisterBrash

Many thanks to both of you. Great article.

Collapse
 
kbk0125 profile image
Kevin Kononenko

Hey, Dirk is correct with his comment about implicit returns. But, for the sake of clarity, I added another code block showing the same function using the return keyword!

Collapse
 
geocine profile image
Aivan Monceller • Edited

This is really nice way of explaining it. However my OCD is killing me , I was expecting the parameters to be animated as they slide down to the landing pad. Still great post!

Collapse
 
mauri profile image
Mauri

xD Same over here :P

Collapse
 
tchaflich profile image
Thomas C. Haflich

It is very difficult for me to not make "wheeee" sound effects while reading this article.

Thank you.