r/learnjavascript • • May 06 '21

JS: Multiple Condition Checking

Post image
484 Upvotes

61 comments sorted by

View all comments

71

u/blafurznarg May 06 '21 edited May 06 '21

rant /

Bruh the learnJS community (not just reddit) is being gaslighted and manipulated by so called mentors and teachers trying to be smart. The early leaners being impressed by every destructuring stunt is not gonna help.

Please never write think about the advantages and disadvantages before writing something like that in prod. If you sacrifice readability for cleverness and shortness at all costs your code will become unmaintainable.

Those who can, do; those who can't, teach [and make instagram posts with useless info].

  • from I don't fucking know

/ rant end sorry

Edit: Cheers to the deleted guy down there. He's right.

23

u/asiraky May 06 '21

“Please never write something like that in prod”.

Nonsense.

I can think of plenty of times where Ive needed to check a range of conditions in non-performance critical code, and I simply use an includes or a some.

8

u/blafurznarg May 06 '21

You're right. There is of course a usecase for that. I guess I was triggered by the post's presentation plus the reaction in the comments. Maybe I shouldn't have emphazised on that particular part to never use it.

4

u/asiraky May 06 '21

And I agree with your general sentiment that shorter code isn’t necessarily better.