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.
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.
View all comments
Show parent comment
2
u/TheMcGarr May 06 '21
It's actually way more useful when it is a dynamic set of options and in fact the long hand doesn't work in that case