News for hackers. Stuff that matters.
Re:Two Things About Conditionals in JavaScript by peterhunt on Monday December 10, 2012 @10:28PM (#4902891)
I don't dispute that your argument has merit, but I disagree. An early exit from a function is an instance of "flat is better than nested" -- that is, it's often easier on the brain to not have to keep track of different layers of nesting. I often use early exits just to get rid off edge cases so the rest of my (non-nested) function can just deal with the "normal" case.
Re:Two Things About Conditionals in JavaScript by untog on Monday December 10, 2012 @10:48PM (#4902932)
Absolutely agree.

    if (a == null) return false;
    stuff();
is considerably better than

    if (a != null) {
        stuff();
    }
Especially once you start dealing with a ton of these cases.