javascriptsyntaxcomparatorconditional-statementsshorthand-if

Is there JS shorthand for conditional "not equal to a and not equal to b" and such?


I was just wondering if there is some JS shorthand for something like this:

if (x != 1 && x != 2) do stuff;

Does such a beast exist? Instead, I want to say something like this:

if (x != 1:2) do stuff;


Solution

  • No that doesn't exist, and that is good! Only in less precise natural language does such a thing exist, which can lead to confusion.