Question about the inequality operator intro to javascript mod

Tell us what’s happening:

i just have a quick question about the examples in this section. it says:

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

my question is about the last 2 examples, shouldn’t 1 != true and 0 != false both return true? thanks

Your code so far

// Setup
function testNotEqual(val) {
if (val) { // Change this line
  return "Not Equal";
return "Equal";


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Comparison with the Inequality Operator

Link to the challenge:

You may be forgetting that != means does not equal.

I’m not sure if you’ve seen the truthy/falsy lesson yet, but essentially 1==true would be correct, but 1===true would be false, or incorrect.

So, 1 != true is false, and 1 !== true is true.

1 Like

this is false, and 1 == true is true because converting true to a number, makes it a 1

when you use the not-strict-equality or disequality symbols, there is type conversion involved, and stuff is converted from a type to an other, so strings to numbers, boolean to numbers, etc

1 Like