DEV Community

Discussion on: Easy refactor ternary conditions to if else

Collapse
 
danielpdev profile image
danielpdev

For me, converting the ternary expression to a function within a function was far more readable.
I had multiple condition for every nested ternary expression and it was hell.

Think about if you have to add some code for one of the nested conditions, for me it's just more easier to have it like that.

It's also not mandatory to leave it like that, I find it easy to refactor the function and not a nested ternary that is on the same line.