Image by Bernard Hermant from Unsplash
DESCRIPTION
Checking multiple values in JavaScript often leads to redundant, boilerplate code - let's use .includes method to fix that.
Handle multiple conditions with ease
Summary
- Avoid multiple if conditions, switch statements, as it's a redundant code you don't need, and most of the time you can solve it with built-in methods.
- .includes
Array
method is useful to minimize additional, boilerplate code when doing multiple condition checks.