Remove Last

Removes the last element of an array.

CategoryArrays
AuthorPol Gubau
Since1.0.0
Last Updated2025-03-15
TypeSync
CompatibilityUniversal

Example

  • Input

    removeLast([1, 2, 3])

    Output:

    [1, 2]

Return

A new array without the last element.

Type: array

Props

NameTypeDefaultRequiredDescription
arrT[]nullYesThe array from which to remove the last element.

Notes

The original array is not mutated.

Tags

  • array
  • remove
  • last
  • element

Related