Skip to main content

All Questions

0 votes
3 answers
4k views

Which is more readable: early returns, or conditionals? [duplicate]

I’m writing an asynchronous, Promise-returning function. In the processing I test some conditions, and if the conditions pass, the promise should be fulfilled (resolved), but if one fails, then the ...
chharvey's user avatar
  • 264
0 votes
3 answers
177 views

Eliminating the bad cases in if to get a nicer code

I have read this link Should I return from a function early or use an if statement? and it triggered a conflict in my head. I agree that it looks nicer and cleaner and I guess that would be the way I ...
acy's user avatar
  • 3