Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the inverse of if statement

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
Can anyone help with the exact reverse of the following line. I tried inserting Not ! but i think I must be putting it in wrong place.

if (email.indexOf("@") < 1 || email.lastIndexOf(".") < email.indexOf("@") + 2 || email.lastIndexOf(".") + 2 >= email.length) {
alert ("I need this to show when the exact opposite of the if statement occurs")
}

Any help would be much appreciated
Thank you
 
You can check boolean operators here

In your case, adding some parentheses, would be something like
Code:
if (!((email.indexOf("@") < 1) || (email.lastIndexOf(".") < email.indexOf("@") + 2) || (email.lastIndexOf(".") + 2 >= email.length))) {
alert ("I need this to show when the exact opposite of the if statement occurs")
}

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top