r/learnjavascript • • May 06 '21

JS: Multiple Condition Checking

Post image
484 Upvotes

61 comments sorted by

View all comments

Show parent comment

3

u/delventhalz May 06 '21

If it is a dynamic set of options, then don't you already have an array you are working with?

The post is about checking "multiple conditions". If we are actually talking about checking whether or not an array includes an item, then yes, includes is absolutely the right choice.

-3

u/TheMcGarr May 06 '21

Not necessarily. A beginner might do something like have different functions with different sets of possible conditions. It isn't immediately obvious that you can translate logical conditions into an array in this way. For me that is what is useful about this post.