Function rotate

  • Rotates a list a number of times. It"s completly agnostic about the contents of the list.

    Type Parameters

    • T

    Parameters

    • times: number

      the number of rotations

    • arr: T[]

    Returns T[]

    the rotated array

    Example

    rotate(1, [1, 2, 3]) // => [2, 3, 1]