• Returns the last element of the given array

    Type Parameters

    • E

    Parameters

    • Optionalarray: null | E[] | readonly E[]

      the array to inspect

    Returns E | undefined

    the last element of the given array

    getLast(['foo', 'bar']);    // 'bar'