Strict Equality Operators

Top  Previous  Next

Operators:  ===  !==

Syntax:

expression1 === expression2

strict equality

expression1 !== expression2

strict inequality

 

The result of the equality operators is either true or false depending whether the expressions are  equal without performing type conversions:

If the expressions are not of the same type, they are not equal.

If the expressions are of type Undefined, they are equal.

If the expressions are of type Null, they are equal.

If the expressions are of type String, then the strings are equal if they are an exact case-sensitive match.

If the expressions are of type Boolean, then they are equal if they are both true or both false.

If the expressions are of type Object, then they are equal if they reference the same object or function.

If the expressions are of type Number their values compared. If either expression is NaN, then they are not equal.

 

The strict inequality operator !== is equivalent to !(expression1 === expression2).