Returns the element at the specified position in the circular array.
Optional
position: numberThe position to peek at (defaults to the current position).
The value at the specified position.
Returns the current index in the circular array.
The current index.
Returns the current index in the circular array.
The current index.
Returns the size of the circular array.
The size of the circular array.
Moves the current position forward by the specified number of steps (1 by default).
The number of steps to move forward (default is 1).
The value at the new current position.
Moves the current position backward by the specified number of steps (1 by default).
The number of steps to move backward (default is 1).
The value at the new current position.
Set the current index in the circular array. Also updates the current position at the index value.
The index to set.
Set the current position in the circular array.
The position to set.
Returns a shallow copy of the circular array as a regular array.
A regular array containing the elements of the circular array.
A circular array implementation that allows for wrapping around the ends.
Example