* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.6 KiB
1.6 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--
在if
语句中,添加不相等运算符!=
,这样函数在当val
不等于 99
的时候,会返回 "Not Equal"。
--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');
你应该使用!=
运算符。
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";
}