Arrays allow you to capture a list of objects of the same type, and find individual objects using a number, called an index.
The index always starts at 0. You can call this the “zeroth element” of the array.
To get a specific element, use [ ] square brackets after the array variable name, with the element number inside. If you use an index that isn’t in the array, you will get
.length will give you the total number of elements in the array.
- If the length of the array is 1, the index of that one element will be
- If the length of the array is 0, there are no elements in the array. Trying any index will give you
- If the length of the array is 7, the index of the last element will be
- In general, you can find the last element using
[myArrayName.length - 1]
You can read more about arrays here: