Tweakr
    Preparing search index...

    Function initial

    • Returns all elements of an array except the last one.

      Type Parameters

      • T

      Parameters

      • array: T[]

        The array to process.

      Returns T[]

      A new array containing all elements except the last one.

      initial([1, 2, 3]);
      // → [1, 2]

      initial([5]);
      // → []

      1.0.0