Inequality

suggest change

The loose inequality operator (!=) is the inverse of the loose equality operator (==). It performs the same type coercion as ==, then negates the result. Prefer strict inequality (!==) unless coercion is intentional.

1 != "1"; // false: the string is converted to a number
1 != 2;   // true

When both sides are objects, they are compared by identity, not by their contents:

({}) != ({}); // true: these are two distinct objects

The strict inequality operator (!==) is the inverse of strict equality (===). It returns true when the values have different types or are not strictly equal:

1 !== "1"; // true
1 !== 2;   // true
1 !== 1;   // false

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents