> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/array/unrotate.md).

# unrotate()

Moves the last item in an array to the beginning.

```javascript
const queue = ['first', 'second', 'third'];

queue.unrotate(); // ['third', 'first', 'second']
```

### Use cases

Use `unrotate()` to move backward through ordered items:

* Return to the previous slideshow item.
* Move the last queued item to the front.
* Reverse a round-robin assignment order.

### More examples

Show the previous slide:

```javascript
const slides = ['intro', 'features', 'pricing'];

slides.unrotate(); // ['pricing', 'intro', 'features']
```

Move the previous assignee to the front:

```javascript
const assignees = ['Ada', 'Lin', 'Sam'];

assignees.unrotate(); // ['Sam', 'Ada', 'Lin']
```
