freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.chinese.md
Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

2.5 KiB

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
56533eb9ac21ba0edf2244d7 Comparison with the Less Than Or Equal To Operator 1 与小于或等于运算符的比较

Description

less than or equal to运算符( <= )比较两个数字的值。如果左边的数字小于或等于右边的数字,则返回true 。如果左侧的数字大于右侧的数字,则返回false 。与等于运算符一样, less than or equal to转换数据类型。 例子
4 <= 5 //是的
'7'<= 7 //是的
5 <= 5 //是的
3 <= 2 //假
'8'<= 4 //假

Instructions

less than or equal to运算符添加到指示的行,以便返回语句有意义。

Tests

tests:
  - text: <code>testLessOrEqual(0)</code>应该返回“小于或等于12”
    testString: assert(testLessOrEqual(0) === "Smaller Than or Equal to 12");
  - text: <code>testLessOrEqual(11)</code>应返回“小于或等于12”
    testString: assert(testLessOrEqual(11) === "Smaller Than or Equal to 12");
  - text: <code>testLessOrEqual(12)</code>应返回“小于或等于12”
    testString: assert(testLessOrEqual(12) === "Smaller Than or Equal to 12");
  - text: <code>testLessOrEqual(23)</code>应返回“小于或等于24”
    testString: assert(testLessOrEqual(23) === "Smaller Than or Equal to 24");
  - text: <code>testLessOrEqual(24)</code>应返回“小于或等于24”
    testString: assert(testLessOrEqual(24) === "Smaller Than or Equal to 24");
  - text: <code>testLessOrEqual(25)</code>应该返回“超过24”
    testString: assert(testLessOrEqual(25) === "More Than 24");
  - text: <code>testLessOrEqual(55)</code>应该返回“超过24”
    testString: assert(testLessOrEqual(55) === "More Than 24");
  - text: 你应该至少使用<code>&lt;=</code>运算符两次
    testString: assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);

Challenge Seed

function testLessOrEqual(val) {
  if (val) {  // Change this line
    return "Smaller Than or Equal to 12";
  }

  if (val) {  // Change this line
    return "Smaller Than or Equal to 24";
  }

  return "More Than 24";
}

// Change this value to test
testLessOrEqual(10);

Solution

// solution required