Getting started with arrays

Terminology

Array literal
A comma separated list of values surrounded by []. For example, ['cats', 'dogs', 'fish'].
Array index
The location of an item in an array. In Javascript, his is always a sequential number starting at 0.
Array item
Any Javascript data type (i.e. value) that an array index points to.
Array length
The number of items in an array. Accessed with the Array.length property.

Key Takeaways


Accessing array items

Given the following array:

const animals = [
'Puppy',
'Bear',
'Moose',
'Coyote',
'Tiger',
'Husky'
];