For what it's worth, I've often seen code like jlongster's example, but never seen code like the OP's example.
Re:Say What You Mean (in JavaScript)
by silvestrov on Tuesday May 18, 2010 @05:38PM
(#1359197)
In the first 2 examples the result of the && operator isn't used.
Re:Say What You Mean (in JavaScript)
by aaronblohowiak on Tuesday May 18, 2010 @04:51PM
(#1359025)
using && as a conditional operator is a common rubyism
In all of jlongster's examples, the result of the '&&' operator is being used. So, someone reading the code can mentally consider the '&&'s to be logical operators.
However, in the article's examples, the result was not being used at all. So, the '&&' was being used not as a 'logical operator' but as a 'conditional operator', which is a non-intuitive use.
Also, '&&' and '||' are not Boolean operators -- they are logical operators, where order matters for short-circuiting.