JavaScript: Test Equality

By Xah Lee. Date: . Last updated: .

Double Equal Operator

The double equal operator == is for testing equality of primitives of the same Type. If operands are of different type, a type conversion is done first. Tip: never use double equal.

Triple Equal Operator

Test Equality of Array/Object

Test Equality of NaN

To compare NaN, use:

Test Equality of Infinity

JavaScript Boolean

JavaScript Operators

JavaScript in Depth