r/JavaScriptTips • u/CrayonConstantinople • Jun 23 '19
Different ways to write Arrow Functions
18
Upvotes
2
u/ronCYA Jun 23 '19
Wow didn't realise you could omit braces + return! That instantly tidied up some code I'm working on right now, thank you so much.
1
u/prof3ssorSt3v3 Jul 16 '19
Don't forget the two ways to write Arrow functions without a parameter
let f1 = () => 'hello from f1';
let f2 = _ => 'hello from f2';Second one uses an underscore.
2
u/spyninjaman Jun 24 '19
addFive will error