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