curriculum/challenges/english/blocks/basic-javascript/56533eb9ac21ba0edf2244d2.md
The inequality operator (!=) is the opposite of the equality operator. Inequality means not equal. The inequality operator returns false when the equality operator 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
Add the inequality operator != in the if statement so that the function will return the string Not Equal when val is not equivalent to 99.
testNotEqual(99) should return the string Equal
assert(testNotEqual(99) === 'Equal');
testNotEqual("99") should return the string Equal
assert(testNotEqual('99') === 'Equal');
testNotEqual(12) should return the string Not Equal
assert(testNotEqual(12) === 'Not Equal');
testNotEqual("12") should return the string Not Equal
assert(testNotEqual('12') === 'Not Equal');
testNotEqual("bob") should return the string Not Equal
assert(testNotEqual('bob') === 'Not Equal');
You should use the != operator
assert(__helpers.removeJSComments(code).match(/(?!!==)!=/));
// Setup
function testNotEqual(val) {
if (val) { // Change this line
return "Not Equal";
}
return "Equal";
}
testNotEqual(10);
function testNotEqual(val) {
if (val != 99) {
return "Not Equal";
}
return "Equal";
}