--- id: bd7993c9c69feddfaeb8bdef title: Store Multiple Values in one Variable using JavaScript Arrays challengeType: 1 videoUrl: '' localeTitle: 使用JavaScript数组在一个变量中存储多个值 --- ## Description
使用JavaScript array变量,我们可以在一个地方存储多个数据。你开始一个带有开口方括号的数组声明,用一个结束的方括号结束,并在每个条目之间加一个逗号,如下所示: var sandwich = ["peanut butter", "jelly", "bread"]
## Instructions
修改新数组myArray ,使其包含stringnumbermyArray顺序)。 暗示
如果卡住,请参阅文本编辑器中的示例代码。
## Tests
```yml tests: - text: myArray应该是一个array 。 testString: 'assert(typeof myArray == "object", "myArray should be an array.");' - text: myArray的第一项应该是一个string 。 testString: 'assert(typeof myArray[0] !== "undefined" && typeof myArray[0] == "string", "The first item in myArray should be a string.");' - text: myArray的第二项应该是一个number 。 testString: 'assert(typeof myArray[1] !== "undefined" && typeof myArray[1] == "number", "The second item in myArray should be a number.");' ```
## Challenge Seed
```js // Example var ourArray = ["John", 23]; // Only change code below this line. var myArray = []; ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```