!==
) является логической противоположностью оператора строгого равенства. Это означает «строго не равно» и возвращает false
когда строгое равенство вернет true
и наоборот . Строгое неравенство не будет преобразовывать типы данных. Примеры 3! == 3 // false
3! == '3' // true
4! == 3 // true
strict inequality operator
if
чтобы функция вернула «Не равно», когда val
строго не равно 17
testStrictNotEqual(17)
должен вернуть «Равный»,'
testString: 'assert(testStrictNotEqual(17) === "Equal", "testStrictNotEqual(17)
should return "Equal"");'
- text: testStrictNotEqual("17")
должен возвращать "Не равно"
testString: 'assert(testStrictNotEqual("17") === "Not Equal", "testStrictNotEqual("17")
should return "Not Equal"");'
- text: testStrictNotEqual(12)
должен вернуть «Не testStrictNotEqual(12)
»
testString: 'assert(testStrictNotEqual(12) === "Not Equal", "testStrictNotEqual(12)
should return "Not Equal"");'
- text: testStrictNotEqual("bob")
должен возвращать "Не равно"
testString: 'assert(testStrictNotEqual("bob") === "Not Equal", "testStrictNotEqual("bob")
should return "Not Equal"");'
- text: Вы должны использовать оператор !==
testString: 'assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, "You should use the !==
operator");'
```