While coding, one of the key things I try to aim for is readability and maintainability - after all, the interpreter or compiler doesn't really care how many lines you've used, but you will care when you try to read it again 6 months later.
In my experience, the ternary operator prioritizes brevity over readability. If we take this to its logical extreme, we'd be naming all our variable 'a1', 'a2' etc...
I have the same feelings. I limit use of ternary operators where it makes sense to use them. Most of the time I use if statements. Reason? I want to opitimize for readability not brevity.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.