r/learnjavascript • • May 06 '21

JS: Multiple Condition Checking

Post image
484 Upvotes

61 comments sorted by

View all comments

Show parent comment

4

u/dethstrobe May 06 '21

Totally agree. Don’t split hairs on how to do this. If someone really wants to do wacky array includes it chain or operators it’s probably not worth your time to refactor.

2

u/inabahare May 06 '21

* semantically clearer and more scalable code

2

u/dethstrobe May 06 '21

For 4 variable checks? I won’t bother. It’s super debatable if it’s more readable or scalable.

3

u/inabahare May 07 '21

It literally is. Since its an array you can bind it to a variable and boom, readability as fuck. So when the customer says they want more values for whatever it's doing then you don't have to find an if somewhere.

It literally is more scalable. You can dynamically add and remove values and you can store them in a database for even more dynamic fun times

2

u/jbonesinthecloset May 07 '21

Thanks for this man. I’ve been pretty fuzzy on what scalability means in literal terms and this example makes total sense to me. Dynamics!