# .toReversed()

> The `.toReversed()` JS method returns a new array with the elements in reverse order, without modifying the original array.

## What does toReversed() do in JavaScript?

The method that creates a new array with the elements in reverse order. Unlike `.reverse()`, this method doesn't modify the original array.

- Topic: Array
- Type: method
- Browser support: Chrome 110+, Chrome Android 110+, Edge 110+, Firefox 115+, Firefox Android 115+, Safari 16+, Safari iOS 16+

## Example

Wrong:

```js
const latest = messages.reverse();
render(latest);
```

Right:

```js
const latest = messages.toReversed();
render(latest);
```

`reverse()` also flips `messages`; `toReversed()` returns a reversed copy and keeps the original.

## Common mistakes

- Calling `toReversed()` and ignoring the return value, expecting the array to change.

## Key points

- Code that must run in older browsers falls back to `[...arr].reverse()`.
- React state and props are reversed with `toReversed()`, not `reverse()`.

## Interview questions

### Is `toReversed()` a deep copy?

No. It returns a new array, but object elements are the same references.

### Does `toReversed()` keep empty slots in sparse arrays?

No. Empty slots become `undefined` in the result, so the new array is never sparse.

## Related cards

- [.reverse()](https://wonderium.dev/js/array-reverse.md)
- [.toSorted()](https://wonderium.dev/js/array-to-sorted.md)
- [.toSpliced()](https://wonderium.dev/js/array-to-spliced.md)
- [.with()](https://wonderium.dev/js/array-with.md)
- [useState()](https://wonderium.dev/react/use-state.md)

---

- Level: [JavaScript](https://wonderium.dev/js.md)
- HTML version: https://wonderium.dev/js/array-to-reversed
- Last updated: 2026-11-25
