2.2 KiB
2.2 KiB
id | title | challengeType | guideUrl | videoUrl | localeTitle |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244cd | Accessing Nested Arrays | 1 | https://spanish.freecodecamp.org/guide/certificates/access-array-data-with-indexes | Acceso a matrices anidadas |
Description
var ourPets = [
{
tipo de animal: "gato",
nombres: [
"Meowzer",
"Mullido",
"Kit-Cat"
]
}
{
tipo de animal: "perro",
nombres: [
"Lugar",
"Bowser",
"Frankie"
]
}
];
ourPets [0] .names [1]; // "Fluffy"
ourPets [1] .names [0]; // "Lugar"
Instructions
myPlants
usando el punto de objeto y la notación de corchete de matriz. Tests
tests:
- text: <code>secondTree</code> debe ser igual a "pino"
testString: 'assert(secondTree === "pine", "<code>secondTree</code> should equal "pine"");'
- text: Use la notación de puntos y corchetes para acceder a <code>myPlants</code>
testString: 'assert(/=\s*myPlants\[1\].list\[1\]/.test(code), "Use dot and bracket notation to access <code>myPlants</code>");'
Challenge Seed
// Setup
var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];
// Only change code below this line
var secondTree = ""; // Change this line
After Test
console.info('after the test');
Solution
// solution required