Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root825313yI’ve never been able to decide if I like implicit returns or not.
On one hand, they make simple methods shorter and cleaner. On the other, they can make non-trivial functions much harder to read — and the linters complain when you use explicit returns where they add clarity.
I suppose I just don’t like the standard linter rules, or messy code. -
10Dev28993yI like JavaScripts way of doing it, where you have explicit returns in everything but one line arrow functions. That way you get the clarity of explicit return while you also have the code beauty of implicit returns
-
Arrow functions can have single expression bodies, which fixes simple functions. If the body is complex enough to warrant a block, an explicit return is better for readability.
-
Root825313y@yellow-dog We don’t care whether or not you care if we like implicit returns or not. 😊
One time i forgot that there are languages where you have to explicitly return stuff and spent a good 20 minutes debugging why
function a() { 2 }
didnt work
rant