• Returns the last element of an array. If the array is empty, raises an error.

    Parameters

    • anArray: any[]

      the array to consider

    Returns any

    the last element of the array

    if the array is empty