Returns the last element of an array or null if the array is empty or not an array.

  • Type Parameters

    • T = any

    Parameters

    • arr: undefined | null | T[]

      The array from which to retrieve the last element.

    Returns null | T

    • The last element of the array or null.