2021-06-15 00:49:18 -07:00
---
id: bd7993c9c69feddfaeb8bdef
2021-07-21 20:53:20 +05:30
title: Armazenar múltiplos valores em uma variável usando arrays JavaScript
2021-06-15 00:49:18 -07:00
challengeType: 1
videoUrl: 'https://scrimba.com/c/crZQWAm'
forumTopicId: 18309
dashedName: store-multiple-values-in-one-variable-using-javascript-arrays
---
# --description--
2021-07-30 01:41:44 +09:00
Com as variáveis de `array` em JavaScript, podemos armazenar diversos dados em um único lugar.
2021-06-15 00:49:18 -07:00
2021-07-30 01:41:44 +09:00
Você começa uma declaração de um array com a abertura de um colchetes, terminando com o fechamento do colchetes e colocando vírgulas entre cada entrada, dessa forma:
2021-06-15 00:49:18 -07:00
```js
2021-10-27 15:10:57 +00:00
const sandwich = ["peanut butter", "jelly", "bread"];
2021-06-15 00:49:18 -07:00
```
# --instructions--
2021-07-30 01:41:44 +09:00
Modifique o novo array `myArray` para que contenha uma string e um número (nessa ordem).
2021-06-15 00:49:18 -07:00
# --hints--
2021-07-14 21:02:51 +05:30
`myArray` deve ser um array.
2021-06-15 00:49:18 -07:00
```js
assert(typeof myArray == 'object');
```
2021-07-14 21:02:51 +05:30
O primeiro item de `myArray` deve ser uma string.
2021-06-15 00:49:18 -07:00
```js
assert(typeof myArray[0] !== 'undefined' & & typeof myArray[0] == 'string');
```
2021-07-14 21:02:51 +05:30
O segundo item de `myArray` deve ser um número.
2021-06-15 00:49:18 -07:00
```js
assert(typeof myArray[1] !== 'undefined' & & typeof myArray[1] == 'number');
```
# --seed--
## --after-user-code--
```js
(function(z){return z;})(myArray);
```
## --seed-contents--
```js
// Only change code below this line
2021-10-27 15:10:57 +00:00
const myArray = [];
2021-06-15 00:49:18 -07:00
```
# --solutions--
```js
2021-10-27 15:10:57 +00:00
const myArray = ["The Answer", 42];
2021-06-15 00:49:18 -07:00
```