[ico20]: https://github.com/garevna/js-course/blob/master/ico/a-level-20.png [ico25]: https://github.com/garevna/js-course/blob/master/ico/a-level-25.png [ico50]: https://github.com/garevna/js-course/blob/master/ico/a-level-30.png [hw-20]: https://github.com/garevna/js-course/blob/master/ico/briefcase-20.png [hw-30]: https://github.com/garevna/js-course/blob/master/ico/briefcase-30.png [hw-40]: https://github.com/garevna/js-course/blob/master/ico/briefcase-40.png [cap-20]: https://github.com/garevna/js-course/blob/master/ico/coffee-20.png [cap-25]: https://github.com/garevna/js-course/blob/master/ico/coffee-20.png [cap-30]: https://github.com/garevna/js-course/blob/master/ico/coffee-20.png [cap-40]: https://github.com/garevna/js-course/blob/master/ico/coffee-20.png [warn-25]: https://github.com/garevna/js-course/blob/master/ico/warning.png [warn-30]: https://github.com/garevna/js-course/blob/master/ico/warning.png [warn-40]: https://github.com/garevna/js-course/blob/master/ico/warning.png [link-20]: https://github.com/garevna/js-course/blob/master/ico/link-20.png [link-25]: https://github.com/garevna/js-course/blob/master/ico/link-25.png [err-20]: https://github.com/garevna/js-course/blob/master/ico/no_entry-20.png [err-25]: https://github.com/garevna/js-course/blob/master/ico/no_entry-25.png [err-30]: https://github.com/garevna/js-course/blob/master/ico/no_entry-30.png [file-20]: https://github.com/garevna/js-course/blob/master/ico/pencil-20.png [file-25]: https://github.com/garevna/js-course/blob/master/ico/pencil-25.png [file-30]: https://github.com/garevna/js-course/blob/master/ico/pencil-30.png [dir-20]: https://github.com/garevna/js-course/blob/master/ico/folder-20.png [dir-25]: https://github.com/garevna/js-course/blob/master/ico/folder-25.png [dir-30]: https://github.com/garevna/js-course/blob/master/ico/folder-30.png [dir-40]: https://github.com/garevna/js-course/blob/master/ico/folder-40.png [bash-20]: https://github.com/garevna/js-course/blob/master/ico/bash-20.png [bash-25]: https://github.com/garevna/js-course/blob/master/ico/bash-25.png [bash-30]: https://github.com/garevna/js-course/blob/master/ico/bash-30.png [bash-40]: https://github.com/garevna/js-course/blob/master/ico/bash-40.png [git-20]: https://github.com/garevna/js-course/blob/master/ico/github-20.png [git-25]: https://github.com/garevna/js-course/blob/master/ico/github-25.png [git-30]: https://github.com/garevna/js-course/blob/master/ico/github-30.png [wink-20]: https://github.com/garevna/js-course/blob/master/ico/wink-20.png [wink-25]: https://github.com/garevna/js-course/blob/master/ico/wink-25.png [wink-30]: https://github.com/garevna/js-course/blob/master/ico/wink-30.png [point-20]: https://github.com/garevna/js-course/blob/master/ico//point_up-20.png [point-25]: https://github.com/garevna/js-course/blob/master/ico/point_up-25.png [point-30]: https://github.com/garevna/js-course/blob/master/ico/point_up-30.png [ok-20]: https://github.com/garevna/js-course/blob/master/ico/ok-20.png [ok-25]: https://github.com/garevna/js-course/blob/master/ico/ok-25.png [ok-30]: https://github.com/garevna/js-course/blob/master/ico/ok-30.png [super-20]: https://github.com/garevna/js-course/blob/master/ico/super-20.png [super-25]: https://github.com/garevna/js-course/blob/master/ico/super-25.png [super-30]: https://github.com/garevna/js-course/blob/master/ico/super-30.png [debagger]: https://github.com/garevna/js-course/blob/master/ico/debag-paused.png "Resume script execution F8 Ctrl+\" [reload]: https://github.com/garevna/js-course/blob/master/ico/reload.png [file-20]: https://github.com/garevna/js-course/blob/master/ico/pencil-20.png [yt-20]: https://github.com/garevna/js-course/blob/master/ico/youtube.png # ![ico25] Структуры данных ## ![ico25] Массивы ###### тип данных: `object` * Массив - это упорядоченный набор переменных * Каждая переменная называется **элементом массива** * Элементы массива имеют порядковый номер ( **_индекс_** элемента массива ) ![warn-25] Индексация элементов массива начинается с нуля, т.е. первый элемент массива будет иметь индекс `0` * Массивы JavaScript заворачиваются в квадратные скобки * Элементы массива разделяются запятыми * Получить элемент массива можно по его **_индексу_** _____________________________________________________________ Запись массива в JS очень проста: элементы массива перечисляются через запятую в квадратных скобках: ``` [ 15, 50, 78 ] ``` Каждый элемент массива может иметь собственный тип данных, отличный от типов других элементов массива #### ![cap-20] 1 ```javascript var numbers = [ 1, 5, 78 ] ```
|
Значение `numbers[0]` будет 1 Значение `numbers[1]` будет 5 Значение `numbers[2]` будет 78 |
|
Значение `students[0]` будет "Николай" Значение `students[1]` будет "Сергей" Значение `students[2]` будет "Иван" |
|
Значение `person[0]` будет "Николай" Значение `person[1]` будет true Значение `person[2]` будет 25 |
|
students[0] : "Иван" students[1] : "Татьяна" students[2] : "Дмитрий" |