Tweakr
    Preparing search index...

    Function last

    • Returns the last element of an array.

      Type Parameters

      • T

      Parameters

      • array: T[]

        The array to query.

      Returns undefined | T

      The last element of the array, or undefined if the array is empty.

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

      last([]);
      // → undefined

      1.0.0