JavaScript Comparison Operations Inequality

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Operator != is the inverse of the == operator.
Will return true if the operands aren't equal.
The javascript engine will try and convert both operands to matching types if they aren't of the same type. Note: if the two operands have different internal references in memory, then false will be returned.

Sample:

1 != '1'     // false
1 != 2       // true

In the sample above, 1 != '1' is false because, a primitive number type is being compared to a char value. Therefore, the Javascript engine doesn't care about the datatype of the R.H.S value.

Operator: !== is the inverse of the === operator. Will return true if the operands are not equal or if their types do not match.

Example:

1 !== '1'    // true
1 !== 2      // true
1 !== 1      // false


Got any JavaScript Question?