I have a function as below
function test (x){
if(x==='a' || x!=='b' ||'c')
{
console.log('result');
console.log(x);
}
else {
console.log('wrong')
}
}
test('123');
And I expect the output will log "wrong", but it log //result 123 as the picture below. I'm not sure is because the if condition can't work like this?

Aucun commentaire:
Enregistrer un commentaire