DEV Community

Discussion on: Why I'm phasing out ternary statements

Collapse
 
denisenepraunig profile image
Denise Nepraunig

Interesting discussion here! The main reason why I always preferred if/else was that I could easily set a breakpoint inside THEN or ELSE. Nowadays I think Google Chrome can set a breakpoint inside a ternary THEN or ELSE, too.

One thing I saw in this discussion here and used intuitively is that I’ve used a ternary to do a simple assignment to a variable, if there is some kind of logic/function calls I would rather use an if-else.

After all these years I still have to think if ? or : comes first when I am writing it xD. Readability depends heavily if the ternary is long or short.