Function initial

  • Gets all but the last element of array.

    Type Parameters

    • T = any

    Parameters

    • array: T[]

      The array to query.

    Returns T[]

    Returns the slice of array.

    5.18.0

    initial([1, 2, 3])
    // => [1, 2]