re: Rethinking JavaScript: The if statement VIEW POST

TOP OF THREAD FULL DISCUSSION
re: if you do return early in function, you don’t need else. Using if is ok imo, with reduce else with return early when possible.
 

I love early returns and I use them in codebases that are imperative and OOP.

But when creating a functional codebase, 98% of my functions have a single statement, and that statement is a return.

When you eliminate statements and blocks, you will find that your codebase naturally becomes more functional.

code of conduct - report abuse