mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-10 18:03:32 -05:00
2.0 KiB
2.0 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
| id | title | challengeType | videoUrl | forumTopicId | dashedName |
|---|---|---|---|---|---|
| 56533eb9ac21ba0edf2244d2 | Порівняння з Оператором "Не дорівнює" | 1 | https://scrimba.com/c/cdBm9Sr | 16787 | comparison-with-the-inequality-operator |
--description--
Оператор "не дорівнює" (!=) є протилежним до оператора рівності. Це означає, що вирази не еквівалентні і що вони повернуться false, де рівність повернеться true і навпаки. Так само, як і оператор рівності, оператор "не дорівнює" конвертує типи даних під час їх порівняння.
Приклади
1 != 2 // true
1 != "1" // false
1 != '1' // false
1 != true // false
0 != false // false
--instructions--
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.
--hints--
testNotEqual(99) має повернути рядок Equal
assert(testNotEqual(99) === 'Equal');
testNotEqual("99") має повернути рядок Equal
assert(testNotEqual('99') === 'Equal');
testNotEqual(12) має повернути рядок Not Equal
assert(testNotEqual(12) === 'Not Equal');
testNotEqual("12") має повернути рядок Not Equal
assert(testNotEqual('12') === 'Not Equal');
testNotEqual("bob") має повернути рядок Not Equal
assert(testNotEqual('bob') === 'Not Equal');
You should use the != operator
assert(code.match(/(?!!==)!=/));
--seed--
--seed-contents--
// Setup
function testNotEqual(val) {
if (val) { // Change this line
return "Not Equal";
}
return "Equal";
}
testNotEqual(10);
--solutions--
function testNotEqual(val) {
if (val != 99) {
return "Not Equal";
}
return "Equal";
}