freeCodeCamp/curriculum/challenges/spanish/02-javascript-algorithms-an.../basic-javascript/store-multiple-values-in-on...

2.0 KiB

id title challengeType videoUrl localeTitle
bd7993c9c69feddfaeb8bdef Store Multiple Values in one Variable using JavaScript Arrays 1 Almacene múltiples valores en una variable utilizando matrices de JavaScript

Description

Con las variables de array JavaScript, podemos almacenar varios datos en un solo lugar. Inicia una declaración de matriz con un corchete de apertura, finalícela con un corchete de cierre y ponga una coma entre cada entrada, como esto: var sandwich = ["peanut butter", "jelly", "bread"] .

Instructions

Modifique la nueva matriz myArray para que contenga tanto una string como un number (en ese orden). Insinuación
Consulte el código de ejemplo en el editor de texto si se atasca.

Tests

tests:
  - text: <code>myArray</code> debería ser una <code>array</code> .
    testString: 'assert(typeof myArray == "object", "<code>myArray</code> should be an <code>array</code>.");'
  - text: El primer elemento en <code>myArray</code> debe ser una <code>string</code> .
    testString: 'assert(typeof myArray[0] !== "undefined" && typeof myArray[0] == "string", "The first item in <code>myArray</code> should be a <code>string</code>.");'
  - text: El segundo elemento en <code>myArray</code> debe ser un <code>number</code> .
    testString: 'assert(typeof myArray[1] !== "undefined" && typeof myArray[1] == "number", "The second item in <code>myArray</code> should be a <code>number</code>.");'

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