2.3 KiB
2.3 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244d2 | Comparison with the Inequality Operator | 1 | 与不等式算子的比较 |
Description
!=
)与等于运算符相反。它意味着“不等于”并返回false
,其中相等性将返回true
, 反之亦然 。与等式运算符一样,不等式运算符将在比较时转换数据类型的值。 例子 1!= 2 //是的
1!=“1”//假
1!='1'//假
1!= true // false
0!= false // false
Instructions
if
语句中添加不等式运算符!=
,以便当val
不等于99
时函数将返回“Not Equal” Tests
tests:
- text: <code>testNotEqual(99)</code>应返回“Equal”
testString: 'assert(testNotEqual(99) === "Equal", "<code>testNotEqual(99)</code> should return "Equal"");'
- text: <code>testNotEqual("99")</code>应该返回“Equal”
testString: 'assert(testNotEqual("99") === "Equal", "<code>testNotEqual("99")</code> should return "Equal"");'
- text: <code>testNotEqual(12)</code>应该返回“Not Equal”
testString: 'assert(testNotEqual(12) === "Not Equal", "<code>testNotEqual(12)</code> should return "Not Equal"");'
- text: <code>testNotEqual("12")</code>应该返回“Not Equal”
testString: 'assert(testNotEqual("12") === "Not Equal", "<code>testNotEqual("12")</code> should return "Not Equal"");'
- text: <code>testNotEqual("bob")</code>应返回“Not Equal”
testString: 'assert(testNotEqual("bob") === "Not Equal", "<code>testNotEqual("bob")</code> should return "Not Equal"");'
- text: 你应该使用<code>!=</code>运算符
testString: 'assert(code.match(/(?!!==)!=/), "You should use the <code>!=</code> operator");'
Challenge Seed
// Setup
function testNotEqual(val) {
if (val) { // Change this line
return "Not Equal";
}
return "Equal";
}
// Change this value to test
testNotEqual(10);
Solution
// solution required