freeCodeCamp Challenge Guide: Comparison with the Inequality Operator

freeCodeCamp Challenge Guide: Comparison with the Inequality Operator
0

#1

The inequality operator (!=) is the opposite of the equality operator. It means “Not Equal” and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.

Examples

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

This is the right answer:
// Setup
function testNotEqual(val) {
if (val != 99) { // Change this line
return “Not Equal”;
}
return “Equal”;
}

// Change this value to test
testNotEqual(10);


#2

help me … why my code is don’t work ?

function testNotEqual(val) {
if (val != 99) { // Change this line
return “Equal”;
}else if(val != ‘99’){
return ‘Equal’;
}else if(val != 12){
return “Not Equal”;
}else if(val != “12”){
return “Not Equal”;
}else if(val !=‘bob’){
return “Not Equal”;
}

}

// Change this value to test
testNotEqual(10);