• Removes an element from the array at the given index, returning the removed element if the index was within range.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The Array to update.

    • index: number

      If negative, will remove from the end of the list (-1 is last element), if greater than or equal to the list length, undefined will be returned.

    Returns T | undefined