DEV Community

Discussion on: How to use arrow functions in JavaScript ES6

Collapse
 
petedermott profile image
Pete Dermott

Good article, thanks!

Whilst I appreciate the changes to "this", I always find the syntax of arrow functions to be damn ugly and confusing. It just never feels verbose enough for a new javascript developer to know what is going on.

Collapse
 
kendalmintcode profile image
Rob Kendal {{☕}} • Edited

Haha, I'm the exact opposite, I love them! But they're like any tool, I think they have a purpose and a place depending on your approach. For me, they offer a great way to introduce more readable code, especially in smaller cases.

For example:

// this, is more readable, or certainly neater
const newArr = oldArr.map(item => item.thing);

// than this,
const newArr = oldArr.map(function(item) { 
 return item.thing; 
});

BUT...

I do agree wholeheartedly with you that terseness != readable all the time and yes, I would imagine less experienced devs (well, all devs really) could get lost with an abuse of over simplified and terse arrow functions littered all over the shop.