Replace Comparisons with Any

Use the Any method to replace conditionals.

How to refactor OR operators inside a conditional

When we need to check if a value belongs to a set of valid options, we use an if statement with the comparisons separated by the OR (||) operator.

Let’s find comedies and dramas from our catalog using a conditional OR operator.

Get hands-on with 1200+ tech skills courses.