Function first

  • Gets the first element of array.

    Type Parameters

    • T

    Parameters

    • array: ArrayLike<T>

      The array to query.

    Returns T | undefined

    Returns the first element of array.

    Since

    5.5.0

    See

    [[head]]

    Example

    first([1, 2, 3]);
    // => 1

    first([]);
    // => undefined