The two if statements given aren't logically equivalent; an equivalent version of the 2nd one would be:<p><pre><code> if (!(input.command === "foo" && isValid(input))) {
...
}
</code></pre>
Which IMHO is the least comprehensible.<p>You can flip the negation by swapping the if/else blocks, but only if there is an else. Then you also get into questions about whether or not it matters which block is on top.