* 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 |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244d3 | 严格不等运算符 | 1 | https://scrimba.com/c/cKekkUy | 16791 | comparison-with-the-strict-inequality-operator |
--description--
严格不相等运算符(!==
)与全等运算符是相反的。这意味着严格不相等并返回false
的地方,用严格相等运算符会返回true
,反之亦然。严格不相等运算符不会转换值的数据类型。
示例
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
--instructions--
在if
语句中,添加严格不相等运算符!==
,这样如果val
与17
严格不相等的时候,函数会返回 "Not Equal"。
--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";
}