Use this shortcut to do multiple checks in one go.
You have seen an or
condition a billion times before, haven’t you?
|
|
We use or
conditions quite a bit, and there is a way to streamline that code.
|
|
Or, you could use an object.
|
|
These methods are particularly useful when you have to run your values through a set of validation rules. Instead of using nested if or switch statements, you can use a simple array or object to make your code more readable.