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.6 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
587d7b7e367417b2b2512b20 Use an Array to Store a Collection of Data 1 使用数组存储数据集合

Description

以下是阵列数据结构最简单实现的示例。这被称为一维数组 ,意味着它只有一个级别,或者它没有嵌套在其中的任何其他数组。请注意,它包含布尔值 字符串数字 以及其他有效的JavaScript数据类型
let simpleArray = ['one'2'three'truefalseundefinednull];
的console.logsimpleArray.length;
//记录7
所有数组都有一个length属性如上所示可以使用语法Array.length轻松访问Array.length 。下面可以看到更复杂的数组实现。这称为多维数组 或包含其他数组的数组。请注意此数组还包含JavaScript 对象 ,我们将在下一节中详细介绍,但是现在,您需要知道的是,数组也能够存储复杂对象。
让complexArray = [
[
{
1
2
}
{
3
4
}
]
[
{
a“a”
b“b”
}
{
c“c”
d“d”
}
]
]。

Instructions

我们定义了一个名为yourArray的变量。通过为yourArray变量指定长度至少为5个元素的数组来完成该语句。您的数组应至少包含一个字符串 ,一个数字和一个布尔值

Tests

tests:
  - text: yourArray是一个数组
    testString: assert.strictEqual(Array.isArray(yourArray), true);
  - text: <code>yourArray</code>至少有5个元素
    testString: assert.isAtLeast(yourArray.length, 5);
  - text: <code>yourArray</code>至少包含一个<code>boolean</code>
    testString: assert(yourArray.filter( el => typeof el === 'boolean').length >= 1);
  - text: <code>yourArray</code>至少包含一个<code>number</code>
    testString: assert(yourArray.filter( el => typeof el === 'number').length >= 1);
  - text: <code>yourArray</code>至少包含一个<code>string</code>
    testString: assert(yourArray.filter( el => typeof el === 'string').length >= 1);

Challenge Seed

let yourArray; // change this line

Solution

// solution required