Files
freeCodeCamp/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md

2.2 KiB
Raw Permalink Blame History

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244d3 Порівняння з Оператором Абсолютної Нерівності 1 https://scrimba.com/c/cKekkUy 16791 comparison-with-the-strict-inequality-operator

--description--

Оператор абсолютної нерівності (!==) є логічною протилежністю оператора абсолютної рівності. Це означає, що "Абсолютно Не Рівно" та визначається false, де абсолютна рівність визначається як true і vice versa. Оператор абсолютної нерівності не буде перетворювати типи даних.

Приклади

3 !==  3
3 !== '3'
4 !==  3

У такому порядку, ці вирази будуть оцінювати, як false, true,true.

--instructions--

Додайте оператора абсолютної нерівності до команди if, щоб функція визначила рядок Not Equal, коли val не є абсолютно рівним 17

--hints--

testStrictNotEqual(17) перетворюється в рядку на Equal

assert(testStrictNotEqual(17) === 'Equal');

testStrictNotEqual("17") перетворюється в рядку на Not Equal

assert(testStrictNotEqual('17') === 'Not Equal');

testStrictNotEqual(12) перетворюється в рядку на Not Equal

assert(testStrictNotEqual(12) === 'Not Equal');

testStrictNotEqual("bob") перетворюється в рядку на Not Equal

assert(testStrictNotEqual('bob') === 'Not Equal');

Вам слід використовувати оператора!==

assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);

--seed--

--seed-contents--

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

testStrictNotEqual(10);

--solutions--

function testStrictNotEqual(val) {
  if (val !== 17) {
    return "Not Equal";
  }
  return "Equal";
}