pols-utils - v5.3.11
    Preparing search index...

    Function moveItem

    • Moves an element from one position to another within an array.

      Parameters

      • array: unknown[]

        The target array.

      • originIndex: number

        The index of the element to move.

      • destinationIndex: number

        The index where the element will be inserted.

      Returns unknown[]

      The same target array.

      const myarray = [0, 1, 2, 3, 4]
      PUtilsArray.moveItem(myarray, 1, 3)
      console.log(myarray) // 0, 2, 3, 1, 4