• Index into the array at the specified position, wrapping around if going off the end. Like the remainder operator (%) except it supports negative values.

    Parameters

    • index: number

      The index into the array.

    • length: number

      The length of the array.

    Returns number

    The wrapped index.