2021-02-06 04:42:36 +00:00
---
id: bd7993c9c69feddfaeb8bdef
2021-02-21 08:49:16 -07:00
title: Almacena múltiples valores en una variable utilizando los arreglos de JavaScript
2021-02-06 04:42:36 +00:00
challengeType: 1
videoUrl: 'https://scrimba.com/c/crZQWAm'
forumTopicId: 18309
dashedName: store-multiple-values-in-one-variable-using-javascript-arrays
---
# --description--
2021-02-21 08:49:16 -07:00
Con las variables de arreglos (`array` ) de JavaScript, podemos almacenar varios datos en un solo lugar.
2021-02-06 04:42:36 +00:00
2021-02-21 08:49:16 -07:00
Inicias una declaración de arreglo con un corchete de apertura, lo terminas con un corchete de cierre, y pones una coma entre cada entrada, de esta forma:
2021-02-06 04:42:36 +00:00
2021-03-15 14:01:16 -06:00
`var sandwich = ["peanut butter", "jelly", "bread"]`
2021-02-06 04:42:36 +00:00
# --instructions--
2021-02-21 08:49:16 -07:00
Modifica el nuevo arreglo `myArray` para que contenga tanto una `string` como un `number` (en ese orden).
2021-02-06 04:42:36 +00:00
# --hints--
2021-02-21 08:49:16 -07:00
`myArray` debe ser un arreglo (`array` ).
2021-02-06 04:42:36 +00:00
```js
assert(typeof myArray == 'object');
```
2021-02-21 08:49:16 -07:00
El primer elemento en `myArray` debe ser una cadena (`string` ).
2021-02-06 04:42:36 +00:00
```js
assert(typeof myArray[0] !== 'undefined' & & typeof myArray[0] == 'string');
```
2021-02-21 08:49:16 -07:00
El segundo elemento en `myArray` debe ser un número (`number` ).
2021-02-06 04:42:36 +00: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
var myArray = [];
```
# --solutions--
```js
var myArray = ["The Answer", 42];
```