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

3.0 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
cf1111c1c12feddfaeb3bdef Use Conditional Logic with If Statements 1 使用条件逻辑和If语句

Description

If语句用于在代码中做出决定。关键字if告诉JavaScript在括号中定义的特定条件下执行花括号中的代码。这些条件称为Boolean条件,它们可能只是truefalse 。当条件计算结果为true ,程序将执行花括号内的语句。当布尔条件的计算结果为false ,大括号内的语句将不会执行。 伪代码
if condition为true {
声明被执行
}
功能测试myCondition{
ifmyCondition{
回归“这是真的”;
}
返回“这是假的”;
}
测试(真); //返回“这是真的”
测试(假); //返回“这是假的”
当使用值true调用test if语句将评估myCondition以查看它是否为true 。因为它是true ,函数返回"It was true" 。当我们使用false值调用test时, myCondition 不为 true并且不执行花括号中的语句,函数返回"It was false"

Instructions

在函数内部创建一个if语句"Yes, that was true"如果参数wasThatTruetrue则返回"Yes, that was true" "No, that was false"否则返回"No, that was false"

Tests

tests:
  - text: <code>trueOrFalse</code>应该是一个函数
    testString: assert(typeof trueOrFalse === "function");
  - text: <code>trueOrFalse(true)</code>应该返回一个字符串
    testString: assert(typeof trueOrFalse(true) === "string");
  - text: <code>trueOrFalse(false)</code>应该返回一个字符串
    testString: assert(typeof trueOrFalse(false) === "string");
  - text: <code>trueOrFalse(true)</code>应该返回“是的,那是真的”
    testString: assert(trueOrFalse(true) === "Yes, that was true");
  - text: <code>trueOrFalse(false)</code>应该返回“Nothat was false”
    testString: assert(trueOrFalse(false) === "No, that was false");

Challenge Seed

// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) {
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {

  // Only change code below this line.



  // Only change code above this line.

}

// Change this value to test
trueOrFalse(true);

Solution

// solution required