r/badcode • sadistic • Apr 22 '21

js ternary operators at their maximum potential

Post image
960 Upvotes

73 comments sorted by

View all comments

7

u/INTO_NIGHT Apr 22 '21

I thought the rule for ternary was have only two things compared not even sure what this would return

8

u/HattyJetty Apr 22 '21

That's why ternary operators are right-associative in most languages. Unlike... ahem... php