JavaScript Operator: not equal
[this page | pdf | back links]
In JavaScript,
the != operator is
the ‘not equal to’ operator:
|
x
|
y
|
x != y
|
|
8
|
8
|
false
|
|
8
|
5
|
true
|
Note: if x and y
are of different type then some type coercion
will typically occur, and values that developers might not immediately
recognise as ‘unequal’ may be deemed unequal by this operator. If you want only
variables that are of the same type to pass the equality test then you should
use the strictly unequal to operator, i.e. !==.
NAVIGATION LINKS
Contents | Prev | Next | JavaScript Operators