[thelist] JavaScript: A Confusion

Mark Howells mark at mountain.ch
Tue Feb 26 16:15:01 CST 2002


> of "!=" but "!" alone confuses me.
> What is the actual meaning of "!" operator? At which places it is needed
> to be used? Where can I use it? And where I cannot use it?

!= means "is not equal to"
! means "not"

Examples of the difference would be as follows. Assume that the variable
loggedIn is a boolean variable (true or false).

if(!loggedIn){alert("you are not logged in!")}
OR
if(loggedIn!=true){alert("you are not logged in!")}

Regards
Mark Howells
<http://www.mark.ac/evl/>




More information about the thelist mailing list