DEV Community

Discussion on: The Ternary Operator vs The Conditional Operator WTF

Collapse
 
danieljsummers profile image
Daniel J. Summers

console.write(post.author === 'joelnet' ? 'You are correct' : 'BZZZZZT!')

>You are correct

I could see the verbiage "a ternary operator" if you're trying to get across that you're not limited to one per statement / function / module / etc., but until they define another one, ? is the ternary operator.

Collapse
 
joelnet profile image
JavaScript Joel

Now I am curious about what a second ternary operator would do...

Collapse
 
danieljsummers profile image
Daniel J. Summers

It does seem that you really only need one, as others could be expressed in terms of the first. I actually gave this probably more thought than I should have, but the only things I could come up with were not conditional operators; they were more combinations of prefix/postfix/infix operators.