.github
api-server
client
config
curriculum
challenges
_meta
arabic
chinese
english
portuguese
russian
spanish
01-responsive-web-design
02-javascript-algorithms-and-data-structures
basic-algorithm-scripting
basic-data-structures
basic-javascript
access-array-data-with-indexes.spanish.md
access-multi-dimensional-arrays-with-indexes.spanish.md
accessing-nested-arrays.spanish.md
accessing-nested-objects.spanish.md
accessing-object-properties-with-bracket-notation.spanish.md
accessing-object-properties-with-dot-notation.spanish.md
accessing-object-properties-with-variables.spanish.md
add-new-properties-to-a-javascript-object.spanish.md
add-two-numbers-with-javascript.spanish.md
adding-a-default-option-in-switch-statements.spanish.md
appending-variables-to-strings.spanish.md
assignment-with-a-returned-value.spanish.md
build-javascript-objects.spanish.md
chaining-if-else-statements.spanish.md
comment-your-javascript-code.spanish.md
comparison-with-the-equality-operator.spanish.md
comparison-with-the-greater-than-operator.spanish.md
comparison-with-the-greater-than-or-equal-to-operator.spanish.md
comparison-with-the-inequality-operator.spanish.md
comparison-with-the-less-than-operator.spanish.md
comparison-with-the-less-than-or-equal-to-operator.spanish.md
comparison-with-the-strict-equality-operator.spanish.md
comparison-with-the-strict-inequality-operator.spanish.md
comparisons-with-the-logical-and-operator.spanish.md
comparisons-with-the-logical-or-operator.spanish.md
compound-assignment-with-augmented-addition.spanish.md
compound-assignment-with-augmented-division.spanish.md
compound-assignment-with-augmented-multiplication.spanish.md
compound-assignment-with-augmented-subtraction.spanish.md
concatenating-strings-with-plus-operator.spanish.md
concatenating-strings-with-the-plus-equals-operator.spanish.md
constructing-strings-with-variables.spanish.md
count-backwards-with-a-for-loop.spanish.md
counting-cards.spanish.md
create-decimal-numbers-with-javascript.spanish.md
declare-javascript-variables.spanish.md
declare-string-variables.spanish.md
decrement-a-number-with-javascript.spanish.md
delete-properties-from-a-javascript-object.spanish.md
divide-one-decimal-by-another-with-javascript.spanish.md
divide-one-number-by-another-with-javascript.spanish.md
escape-sequences-in-strings.spanish.md
escaping-literal-quotes-in-strings.spanish.md
find-the-length-of-a-string.spanish.md
finding-a-remainder-in-javascript.spanish.md
generate-random-fractions-with-javascript.spanish.md
generate-random-whole-numbers-with-javascript.spanish.md
generate-random-whole-numbers-within-a-range.spanish.md
global-scope-and-functions.spanish.md
global-vs.-local-scope-in-functions.spanish.md
golf-code.spanish.md
increment-a-number-with-javascript.spanish.md
initializing-variables-with-the-assignment-operator.spanish.md
introducing-else-if-statements.spanish.md
introducing-else-statements.spanish.md
iterate-odd-numbers-with-a-for-loop.spanish.md
iterate-through-an-array-with-a-for-loop.spanish.md
iterate-with-javascript-do...while-loops.spanish.md
iterate-with-javascript-for-loops.spanish.md
iterate-with-javascript-while-loops.spanish.md
local-scope-and-functions.spanish.md
logical-order-in-if-else-statements.spanish.md
manipulate-arrays-with-pop.spanish.md
manipulate-arrays-with-push.spanish.md
manipulate-arrays-with-shift.spanish.md
manipulate-arrays-with-unshift.spanish.md
manipulating-complex-objects.spanish.md
modify-array-data-with-indexes.spanish.md
multiple-identical-options-in-switch-statements.spanish.md
multiply-two-decimals-with-javascript.spanish.md
multiply-two-numbers-with-javascript.spanish.md
nest-one-array-within-another-array.spanish.md
nesting-for-loops.spanish.md
passing-values-to-functions-with-arguments.spanish.md
practice-comparing-different-values.spanish.md
profile-lookup.spanish.md
quoting-strings-with-single-quotes.spanish.md
record-collection.spanish.md
replacing-if-else-chains-with-switch.spanish.md
return-a-value-from-a-function-with-return.spanish.md
return-early-pattern-for-functions.spanish.md
returning-boolean-values-from-functions.spanish.md
selecting-from-many-options-with-switch-statements.spanish.md
shopping-list.spanish.md
stand-in-line.spanish.md
store-multiple-values-in-one-variable-using-javascript-arrays.spanish.md
storing-values-with-the-assignment-operator.spanish.md
subtract-one-number-from-another-with-javascript.spanish.md
testing-objects-for-properties.spanish.md
understand-string-immutability.spanish.md
understanding-boolean-values.spanish.md
understanding-case-sensitivity-in-variables.spanish.md
understanding-undefined-value-returned-from-a-function.spanish.md
understanding-uninitialized-variables.spanish.md
updating-object-properties.spanish.md
use-bracket-notation-to-find-the-first-character-in-a-string.spanish.md
use-bracket-notation-to-find-the-last-character-in-a-string.spanish.md
use-bracket-notation-to-find-the-nth-character-in-a-string.spanish.md
use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.spanish.md
use-conditional-logic-with-if-statements.spanish.md
use-multiple-conditional-ternary-operators.spanish.md
use-the-conditional-ternary-operator.spanish.md
use-the-parseint-function-with-a-radix.spanish.md
use-the-parseint-function.spanish.md
using-objects-for-lookups.spanish.md
word-blanks.spanish.md
write-reusable-javascript-with-functions.spanish.md
debugging
es6
functional-programming
intermediate-algorithm-scripting
javascript-algorithms-and-data-structures-projects
object-oriented-programming
regular-expressions
03-front-end-libraries
04-data-visualization
06-information-security-and-quality-assurance
08-coding-interview-prep
09-certificates
formattingConversion
math-challenges
requiresTests
schema
test
.babelrc
.editorconfig
.npmignore
.travis.yml
CHANGELOG.md
LICENSE.md
commitizen.config.js
commitlint.config.js
create-challenge-bundle.js
getChallenges.js
gulpfile.js
index.js
lib.js
md-translation.js
package-entry.js
package-lock.json
package.json
utils.js
docs
guide
mock-guide
tools
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.node-inspectorrc
.prettierrc
.snyk
.travis.yml
.vcmrc
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile.tests
LICENSE.md
README.french.md
README.italian.md
README.md
change_volumes_owner.sh
docker-compose-shared.yml
docker-compose.tests.yml
docker-compose.yml
lerna.json
netlify.toml
package-lock.json
package.json
sample.env
2.0 KiB
2.0 KiB
id, title, challengeType, videoUrl, localeTitle
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
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
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