!==
)与严格相等运算符的逻辑相反。它意味着“严格不等于”并返回false
,其中严格相等将返回true
, 反之亦然 。严格的不等式不会转换数据类型。 例子 3!== 3 //假
3!=='3'//是的
4!== 3 //是的
strict inequality operator
添加到if
语句,以便当val
不严格等于17
时,函数将返回“Not Equal” testStrictNotEqual(17)
应返回“Equal”
testString: 'assert(testStrictNotEqual(17) === "Equal", "testStrictNotEqual(17)
should return "Equal"");'
- text: testStrictNotEqual("17")
应返回“Not Equal”
testString: 'assert(testStrictNotEqual("17") === "Not Equal", "testStrictNotEqual("17")
should return "Not Equal"");'
- text: testStrictNotEqual(12)
应该返回“Not Equal”
testString: 'assert(testStrictNotEqual(12) === "Not Equal", "testStrictNotEqual(12)
should return "Not Equal"");'
- text: testStrictNotEqual("bob")
应返回“Not Equal”
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");'
```