Function rotateCircularArray

  • Parameters

    • array: any[]

      an array containing any type

    • newStartIndex: number

      the current index to become the new 0 index.

    Returns any[]

    a copy of the original array, rotated.

    Description

    Given an array considered to be circular, where the end connects back to the start, rotate the array so that the value currently in the newStartIndex spot becomes the first (0) index.