Menu
Restarted my JS studies coz it was doing my head in :p
Can some please explain this for me?
[CODE]
if(email.indexOf(“@”) != -1){ alert(“You have an @ in your email address”); }
This code produces an alert if there is an @ in the input field. BUT… Why the != -1? Why not? == 1? I tried… It doesn’t work. It only works if I go, == 0
Just looking for an explanation as to why. Thanks in advance folks
?