--- id: 56533eb9ac21ba0edf2244cd title: Accessing Nested Arrays challengeType: 1 guideUrl: 'https://russian.freecodecamp.org/guide/certificates/access-array-data-with-indexes' videoUrl: '' localeTitle: Доступ к вложенным массивам --- ## Description
Как мы видели в предыдущих примерах, объекты могут содержать как вложенные объекты, так и вложенные массивы. Подобно доступу к вложенным объектам, нотация матричного массива может быть привязана для доступа к вложенным массивам. Ниже приведен пример доступа к вложенному массиву:
var ourPets = [
{
animalType: "cat",
имена: [
"Meowzer",
«Пушистый»,
«Кит-Кат»
]
},
{
animalType: «собака»,
имена: [
"Место",
"Bowser",
«Фрэнки»
]
}
];
ourPets [0] .names [1]; // "Пушистый"
ourPets [1] .names [0]; // "Место"
## Instructions
myPlants второе дерево из переменной myPlants используя myPlants объектов dot и массива.
## Tests
```yml tests: - text: secondTree должен равняться "сосне" testString: 'assert(secondTree === "pine", "secondTree should equal "pine"");' - text: Используйте обозначения точек и скобок для доступа к myPlants testString: 'assert(/=\s*myPlants\[1\].list\[1\]/.test(code), "Use dot and bracket notation to access myPlants");' ```
## Challenge Seed
```js // 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
```js console.info('after the test'); ```
## Solution
```js // solution required ```