Skip to content

re: JavaScript Ternary Operator VIEW POST


There's nothing more beautiful than a well executed ternary expression.

It becomes especially useful when working with templates where you want a simple inline way of switching between behaviors or components.

If you'd like some more things to look into, thing about what happens when you use logical operators (&&, ||) to determine what parts of code run (also super useful when templating, but also for providing defaults like const x = someParameter || 'defaultString').

code of conduct - report abuse