Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* 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>
2021-01-12 19:31:00 -07:00

1.5 KiB
Raw Blame History

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244d1 严格相等运算符 1 https://scrimba.com/c/cy87atr 16790 comparison-with-the-strict-equality-operator

--description--

严格相等运算符(===)是相对相等操作符(==)的另一种比较操作符。与相等操作符不同的是,它会同时比较元素的值和数据类型

如果比较的值类型不同,那么在严格相等运算符比较下它们是不相等的,会返回 false 。

示例

3 ===  3   // true
3 === '3'  // false

3是一个数字类型的,而'3'是一个字符串类型的,所以 3 不全等于 '3'。

--instructions--

if语句值使用严格相等运算符,这样当val严格等于7的时候函数会返回"Equal"。

--hints--

testStrict(10)应该返回 "Not Equal"。

assert(testStrict(10) === 'Not Equal');

testStrict(7)应该返回 "Equal"。

assert(testStrict(7) === 'Equal');

testStrict("7")应该返回 "Not Equal"。

assert(testStrict('7') === 'Not Equal');

你应该使用===运算符。

assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);

--seed--

--seed-contents--

// Setup
function testStrict(val) {
  if (val) { // Change this line
    return "Equal";
  }
  return "Not Equal";
}

testStrict(10);

--solutions--

function testStrict(val) {
  if (val === 7) {
    return "Equal";
  }
  return "Not Equal";
}