11.9 Equality Operators

2010-05-17

EqualityExpression :
RelationalExpression
EqualityExpression == RelationalExpression
EqualityExpression != RelationalExpression
EqualityExpression === RelationalExpression
EqualityExpression !== RelationalExpression

EqualityExpressionNoIn :
RelationalExpressionNoIn
EqualityExpressionNoIn == RelationalExpressionNoIn
EqualityExpressionNoIn != RelationalExpressionNoIn
EqualityExpressionNoIn === RelationalExpressionNoIn
EqualityExpressionNoIn !== RelationalExpressionNoIn

Always returns a boolean. The NoIn versions are evaluated exactly the same as their counterparts.

The difference between the equality (==) and strict equality (===) is mainly that strict does not coerce. Strict equality requires the two operands to be of the same type, or false is returned regardless. Objects are strictly equal if both operands point to the same object. Strings must have the same value to match.

The difference (of the strict equality operator) with the SameValue function is the treatment of signed zeroes and NaN.