I want to have a short if statement on one line that checks if condition A is met and then check if condition B is met, where both conditions are specific strings, but condition B has more than one valid option.
if (cond_A === 'Bradley' && cond_B === 'April' || cond_B === 'May') { ... }
This seems to work, but is it safe from giving unexpected/undesired results? Undesirable in this case would be interpreting just cond_B === 'May'
as meeting the conditions. I guess I'm asking about order of operations: does &&
have precedence over ||
? I want the results to be the same as
if (cond_A === 'Bradley') {
if (cond_B === 'April' || cond_B === 'May') {
...
}
}
Thank you.