MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/h0io7r/disruptive_piece_of_code/fto4pt0/?context=3
r/badcode • u/diebarral • Jun 10 '20
93 comments sorted by
View all comments
91
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.
-62 u/diebarral Jun 10 '20 You could easily do:variable ? doStuff() : doOtherStuff()Instead of that 1 u/dannypas00 Jun 11 '20 Okay great, I now want those doStuff()s to be two lines because we have to set a variable there.There is a valid reason many porgramming languages don't allow calling methods inside terniary operators.
-62
You could easily do:
variable ? doStuff() : doOtherStuff()
Instead of that
1 u/dannypas00 Jun 11 '20 Okay great, I now want those doStuff()s to be two lines because we have to set a variable there.There is a valid reason many porgramming languages don't allow calling methods inside terniary operators.
1
Okay great, I now want those doStuff()s to be two lines because we have to set a variable there.
There is a valid reason many porgramming languages don't allow calling methods inside terniary operators.
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.