• Return a copy of arr with the element at from relocated to index to (standard splice-move semantics: remove, then insert at to). Returns an unchanged copy when either index is out of range. Never mutates the input.

    Type Parameters

    • T

      The array element type.

    Parameters

    • arr: readonly T[]

      The source array (not mutated).

    • from: number

      The index of the element to move.

    • to: number

      The destination index in the resulting array.

    Returns T[]

    A new array with the element moved.