re: We don't need a ternary operator VIEW POST


Noted that this is already commented elsewhere, but your binary conditional operator seems a lot like this logic operator abuse in JS:

condition && positive || negative
// ===
(condition && positive) || negative
// ===
condition ? positive : negative

And whenever I see the former I rewrite it as the latter (because it is more semantic, not because I am obsessed with removing 2 characters)

(Also, a falsy positive would cause negative to be evaluated and returned)

code of conduct - report abuse