So, a junior programmer on my team today wrote the following piece of code:
if(status === (\"incomplete\" || \"unknown\"))
Which is obvious
But what I can't explain is why exactly
status === ("incomplete" || "unknown")wouldn't work
That's because the expression in the parenthesis is evaluated first. The non-empty string incomplete is truthy, so the OR-expression ("incomplete" || "unknown") yields "incomplete" and only that is then compared with your status variable.
To shorten the condition, there are many ways including arrays of values, regular expression test etc.