* 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
1.7 KiB
1.7 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
bd7993c9c69feddfaeb8bdef | Store Multiple Values in one Variable using JavaScript Arrays | 1 | 使用JavaScript数组在一个变量中存储多个值 |
Description
array
变量,我们可以在一个地方存储多个数据。你开始一个带有开口方括号的数组声明,用一个结束的方括号结束,并在每个条目之间加一个逗号,如下所示: var sandwich = ["peanut butter", "jelly", "bread"]
。 Instructions
myArray
,使其包含string
和number
( 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