1.4 KiB
1.4 KiB
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bd7993c9c69feddfaeb8bdef | Almacena múltiples valores en una variable utilizando los arreglos de JavaScript | 1 | https://scrimba.com/c/crZQWAm | 18309 | store-multiple-values-in-one-variable-using-javascript-arrays |
--description--
Con las variables de arreglos (array
) de JavaScript, podemos almacenar varios datos en un solo lugar.
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:
var sandwich = ["peanut butter", "jelly", "bread"]
--instructions--
Modifica el nuevo arreglo myArray
para que contenga tanto una string
como un number
(en ese orden).
--hints--
myArray
debe ser un arreglo (array
).
assert(typeof myArray == 'object');
El primer elemento en myArray
debe ser una cadena (string
).
assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
El segundo elemento en myArray
debe ser un número (number
).
assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
--seed--
--after-user-code--
(function(z){return z;})(myArray);
--seed-contents--
// Only change code below this line
var myArray = [];
--solutions--
var myArray = ["The Answer", 42];