Accessing the Last Item in an Array

By: Dusty Arlia
Published on September 13, 2012<
Last Updated on Friday, July 03, 2015 at 3:33 PM
Total Updates: 6

Using the array's length property you can access the last item in an array named slideshowPictures like this:

slideshowPictures[slideshowPictures.length - 1]

This works because the index number of the last item in an array is always one less than the total number of items in that array.