JavaScript arrays are used to store multiple values in a single variable in this example.
We've created an array variable called fruits and stored six values into it.
Each value contains the name of a fruit the six values we have our apple orange pear grape tangerine
and mango
in order to output a specific value in the array.
We can refer to it using an index number the index number starts with zero.
The first item in the array is identified by the index number zero.
In this case Apple if the index number was one we would be referencing orange and so on.
Since we've used an index number of 0 when we preview this in our web browser
we'll see that the word apple is displayed.
This is the first item in the array if we change the index number to three
we'll see that the the word displayed in our web browser changes to grape
and that's how we reference individual items in the array.
In this situation where we wanted to display the number of items in the array.
So for example here we have six items
we can use the length property we've used the length property before
and when we save the file and refresh the page we can see that the number 6 has been output because
there are six items in the array.