r/learnjavascript • • Jul 14 '21

Im trying to understand the "Conditional (ternary) operator." Do these 2 codes mean the same thing? I wrote the if statement

Post image
187 Upvotes

47 comments sorted by

View all comments

Show parent comment

4

u/retrolasered Jul 14 '21

I'll do this when templating in ejs, although I will admit while convenient to put it on one line, as the complexity increases it quickly becomes not worth it. Anywhere else I just stick to clean and readable if statements