News for hackers. Stuff that matters.
Re:Avoid Else, Return Early (2013) by louhike on Monday March 26, 2018 @08:22AM (#16678271)
I agree with much of the article (return early, errors management at the top, etc.). But won't returning a "wrong" value for the sake of one less line worsens the readability of the code?

When I saw that, I imagined myself spending 10 minutes trying to understand why he does that. But maybe I'm not familiar with a JS best practice here.

Re:Avoid Else, Return Early (2013) by timoxley on Monday March 26, 2018 @01:03PM (#16680450)
The `err, result` function signature implies the function is an asynchronously executed node-style callback, which can never return anything anyway. Well, it can return something, but nothing internal reads it and there's no way for user code to access the returned value so return becomes only useful for short-circuiting.
Re:Avoid Else, Return Early (2013) by wiz21c on Monday March 26, 2018 @08:25AM (#16678292)
returning a wrong result is definitely wrong. It conveys some unexpected meaning and side effects...