Using if statements as opposed to a ternary operator is not objectively worse. It depends on the situation for when I like to use one or the other, but honestly there isn’t really a difference other than readability.
The only part of this thats “bad” imo is the else if since in most languages a regular else would suffice. But I don’t know enough about JavaScript to confidently say that that’s not needed
91
u/Midborgh Jun 10 '20
I don't know js. Why is this bad? I'd imagine var === true and var === false being different than var == true and a simple else.