Returns the first element of an array.

  • Type Parameters

    • T = any

      The type of array elements.

    Parameters

    • arr: undefined | null | T[]

      The input array.

    Returns null | T

    • The first element of the array, or null if the array is null or empty.