News for hackers. Stuff that matters.
Re:Of parser-fetishists and semi-colons by bzbarsky on Monday April 16, 2012 @04:18PM (#3849187)
In JavaScript, && does not evaluate to a boolean. It evaluates to the thing on the left if that thing is false (in which case the right hand side is not evaluated at all), otherwise to the thing on the right. So in said JavaScript console,

  "asdas" && "da"
evaluates to "da" and

  "" && "da"
evaluates to "".

So in an assignment context |r = a && b| would need to be replaced by: if (a) { r = a } else { r = b }, which may or may not be more confusing than the original statement with &&. But in a statement context, where the result of && is not being assigned to anything at all, "a && b" is exactly the same as "if (a) b;" except harder to understand.

Re:Of parser-fetishists and semi-colons by nemetroid on Monday April 16, 2012 @09:56PM (#3850608)
Nitpick: you mean `if (!a) {r = a} else {r = b}` (or switched blocks).
Re:Of parser-fetishists and semi-colons by bzbarsky on Friday April 20, 2012 @01:21AM (#3866603)
Er, yes. Of course I do. ;)