lundi 11 janvier 2021

if condition logical OR

I want to check both conditions and if one of them is true, then I want to redirect. I used ||. If 'Operations' or 'Account' is not found in empDept, I want to redirect. But it's redirecting if 'Account' and 'Operations' is not found. i don't want to redirect if one is found

Don't know where I am wrong, please help

if (empDept.search('Operations') !== 0 || empDept.search('Account') !== 0) {
    redirect
}

The search function returns 0 or -1.

Aucun commentaire:

Enregistrer un commentaire