# Basic JavaScript - Comparison with the Inequality Operator

### Tell us what’s happening:

Describe your issue in detail here.
In the example, it says

``````1 !=  2    // true
1 != "1"   // false
1 != '1'   // false
1 != true  // false
0 != false // false
``````

I am confused about 2nd and 3rd, If I am understanding it, it is saying 1 is not equal ‘1’, here it does type coercin which should make both a number then why and how 1 is not equal to 1, same thing with third, it is just double quote vs single quote.

Am I missing something?

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36`

### Challenge Information:

Basic JavaScript - Comparison with the Inequality Operator

It doesn’t mean that `1` is not equal `'1'`, on the contrary. The question is whether `1` is not equal `'1'`:

``````1 != '1'  // false
``````

Result of such evaluation is `false`, which means that both sides are equal. Therefore:

``````1 == '1'  // true
``````
2 Likes

The inequality operator checks for inequality. It returns true if the expression is unequal and returns false if it’s equal. Here, a type of coercion will be done, the string will be turned into a number, and the number will be 1. Since 1 will be equal to 1 after type coercion, it returns false. The third one is similar to the second only that they’ve used single quotation marks.

This concept really making my head spin, in english it says “one is not euqal one which is false”. I even can’t imagine what is going on here. halp!

The concept is this. When it’s unequal, it will return true, when equal it will return false. It’s the opposite of what you expected.

1 Like

Try formulating it in this way: Result of check whether `1` and `'1'` are not equal is false.

1 Like

For the inequality operator, pretend you’re in the mirror verse. Whatever the comparison is in the mirror verse, then on the other side of the mirror the result will be the opposite.

1 Like

Thanks, this is good example.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.