DEV Community

Discussion on: How Ternaries Can Improve Your JavaScript Conditionals

Collapse
fasani profile image
Michael Fasani

I think your absolutely right regarding “Don't chain multiple ternaries together”. In the code base I work on they allow this practice, but I really really dislike it. I think reading code should be as easy as reading a book. Comments are also underrated in my opinion. I honestly think each line of code should be editable later by a junior or senior dev alike. People think they are being smart using multiple ternaries but they are creating a form of fragile code IMO.

Collapse
alainvanhout profile image
Alain Van Hout

Indeed. They think they are being smart, while in fact they are being clever. And clever code is almost always bad code.