get the last element index in an array code example Example: how to get last element of array return array[array.length - 1];