loading...

re: What do you think about the ternary operator? VIEW POST

FULL DISCUSSION
 

Nitpick: It's a ternary operator known as the conditional operator. For instance in javascript:

The conditional (ternary) operator is the only JavaScript operator that takes three operands. This operator is frequently used as a shortcut for the if statement.

(ref: MDN Web docs : Conditional (ternary) Operator

I use it quite often. I'm a fan of the formatting style that Nimmo proposes, using a newline for the ? part and another newline for the : such that I don't have to scroll sideways.

 

Yeah. Thanks for pointing that out.

Code of Conduct Report abuse