DEV Community

Discussion on: why you shouldn't use arrow functions?

Collapse
 
saba1121 profile image
Saba1121

const holidays = () => return "Merry Christmas and a happy new year πŸ˜€!"

In this example you dont really need word "return". Arrow functions which are one line and dont use curly braces automatically return result. So it should be like this:

const holidays = () => "Merry Christmas and a happy new year πŸ˜€!"

Collapse
 
blessinghirwa profile image
Blessing Hirwa

I wanted to be more clear. But yours also works well.

Collapse
 
blessinghirwa profile image
Blessing Hirwa

I also changed it lol.

Collapse
 
lucgauer profile image
Lucas Gauer • Edited

Usage of return explicitly into a single statement arrow function (without the curly brackets), is actually a syntax error πŸ™.