How does js determine that a value is not equal to xx or xx?

problem description

case: if there is an a, the condition is satisfied when it is neither equal to 0 nor equal to 1. How to apply ! = and in jsx | | ?

...
{
    a != (0 || 1) ? "yes" : "no"
}
...

the above can only judge 0. Is there any solution?

Mar.25,2022

you can use:

a !== 0 && a!== 1

or includes :

![0, 1].includes(a)
Menu