Availability: |
| ||||||||
Property/method value type: | Boolean primitive | ||||||||
JavaScript syntax: | - | anOperand1 != anOperand2 | |||||||
Argument list: | anOperand1 | A value to be compared | |||||||
anOperand2 | Another value to be compared |
The two operands are compared, and the Boolean true value is returned if they are not equal, otherwise false if they are equal. Note that JavaScript will attempt to convert both operands to the same type for comparison.
When testing for inequality, the following rule is invariant:
A != B
is equivalent to:
!(A == B)
Also, the rule of positioning allows that:
A == B
is identical to:
B == A
(Apart from the fact that exchanging the operands in this way alters the order in which they are evaluated.)
Exchanging the operands may have undesirable side effects if they are expressions. For example, they may call functions and test the results. If the functions are not totally independent of one another, you may get unexpected results.
The associativity is from left to right.
Refer to the Operator Precedence topic for details of execution order.
Refer to the Equality expression topic for a discussion on the ECMA standard definition of the equality testing rules.
ECMA 262 edition 2 - section - 11.9.2
ECMA 262 edition 2 - section - 11.9.3
ECMA 262 edition 3 - section - 11.9.2
ECMA 262 edition 3 - section - 11.9.3
Prev | Home | Next |
Not a number | Up | NOT Identically equal to (!==) |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |