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

2.0 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244d4 大于运算符 1 https://scrimba.com/c/cp6GbH4 16786 comparison-with-the-greater-than-operator

--description--

使用大于运算符(>)来比较两个数字。如果大于运算符左边的数字大于右边的数字,将会返回true。否则,它返回false

与相等运算符一样,大于运算符在比较的时候,会转换值的数据类型。

例如

5   >  3   // true
7   > '3'  // true
2   >  3   // false
'1' >  9   // false

--instructions--

添加大于运算符到指定的行,使得返回的语句是有意义的。

--hints--

testGreaterThan(0)应该返回 "10 or Under"。

assert(testGreaterThan(0) === '10 or Under');

testGreaterThan(10)应该返回 "10 or Under"。

assert(testGreaterThan(10) === '10 or Under');

testGreaterThan(11)应该返回 "Over 10"。

assert(testGreaterThan(11) === 'Over 10');

testGreaterThan(99)应该返回 "Over 10"。

assert(testGreaterThan(99) === 'Over 10');

testGreaterThan(100)应该返回 "Over 10"。

assert(testGreaterThan(100) === 'Over 10');

testGreaterThan(101)应该返回 "Over 100"。

assert(testGreaterThan(101) === 'Over 100');

testGreaterThan(150)应该返回 "Over 100"。

assert(testGreaterThan(150) === 'Over 100');

你应该使用>运算符至少两次。

assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);

--seed--

--seed-contents--

function testGreaterThan(val) {
  if (val) {  // Change this line
    return "Over 100";
  }

  if (val) {  // Change this line
    return "Over 10";
  }

  return "10 or Under";
}

testGreaterThan(10);

--solutions--

function testGreaterThan(val) {
  if (val > 100) {  // Change this line
    return "Over 100";
  }
  if (val > 10) {  // Change this line
    return "Over 10";
  }
  return "10 or Under";
}