DEV Community

Discussion on: A harsh critic.

 
deciduously profile image
Ben Lovy • Edited

I'm not Adam, but this post gives a thorough discussion of why it's not a great idea to use arrow functions specifically as method definitions, under the heading "Where You Should Not Use Arrow Functions" a little over halfway through. They're fine to keep using in general, just with caveats.

The short answer is "JavaScript", the medium answer is that arrow functions are like closures or lambdas if you know what those are from other languages, which means they operate in their parent's calling context as opposed to creating their own separate context. This can cause unintended behavior at worst, or at least lead to code reliant on implicit as opposed to explicit behavior which hurts readability.

Also a beginner, though, Adam may have a better/more correct take.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Yep pretty much my opinion on arrows for example. They don't make sense everywhere, even if they do work everywhere. And your sighted post is bang on the money ... Imo 😁.