DEV Community

Discussion on: Replace your switch statement and multiple "if and else", using Object Literals - [en-US].

Collapse
kibobishtrudelz profile image
Petar Kolev

From syntactic point of view ternary is way more terrible to read instead of switch :d

Collapse
hanpari profile image
Pavel Morava

Do you think so?

Still, switch is error-prone construction while chaining ternany is one expression.

Thread Thread
kibobishtrudelz profile image
Petar Kolev

Yes, I do because in my work’s project we have many ternary operators used and when they are long it’s brain damaging while reading them. Again - just from synthetic point of view :)

Thread Thread
hanpari profile image
Pavel Morava

Well, I guess it depends. The simplicity of conditions is basic requirement