OK agree with the above example — also use that.
Maslukov Alexander

It definitely depends. For me I always try to use a ternary first. If my if statement is too complicated to become a ternary, then it’s a sign for me to break it down. After broken down it is often easily becomes a ternary.

I do still (rarely) use an if statement over a ternary just for readability. But for 95% of my conditionals, I do use a ternary.

Like what you read? Give Joel Thoms a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.