freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.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

1.7 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
bd7993c9c69feddfaeb8bdef Store Multiple Values in one Variable using JavaScript Arrays 1 使用JavaScript数组在一个变量中存储多个值

Description

使用JavaScript array变量,我们可以在一个地方存储多个数据。你开始一个带有开口方括号的数组声明,用一个结束的方括号结束,并在每个条目之间加一个逗号,如下所示: var sandwich = ["peanut butter", "jelly", "bread"]

Instructions

修改新数组myArray ,使其包含stringnumber myArray顺序)。 暗示
如果卡住,请参阅文本编辑器中的示例代码。

Tests

tests:
  - text: <code>myArray</code>应该是一个<code>array</code> 。
    testString: assert(typeof myArray == 'object');
  - text: <code>myArray</code>的第一项应该是一个<code>string</code> 。
    testString: assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
  - text: <code>myArray</code>的第二项应该是一个<code>number</code> 。
    testString: assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');

Challenge Seed

// Example
var ourArray = ["John", 23];

// Only change code below this line.
var myArray = [];

After Test

console.info('after the test');

Solution

// solution required