Is there a shorthand for the following?
startsWith !== '' || contains !== '' || endsWith !== ''
I am looking for something more clean but not the overkill
Is there a shorthand for the following?
startsWith !== '' || contains !== '' || endsWith !== ''
I am looking for something more clean but not the overkill
Assuming that they are variables, you could create an array from startsWith
, contains
and endsWith
and then check the array contains an empty string like below:
const array = [startsWith, contains, endsWith];
if (!array.includes('')) {
...
}