Array

Array.prototype.toReversed

Returns a new array with the elements in reversed order, without modifying the original array

Syntax

JavaScript
array.toReversed()

Return Value

A new reversed array

Examples

Basic Usage
const arr = [1, 2, 3, 4, 5];
const reversed = arr.toReversed();
console.log(reversed); // [5, 4, 3, 2, 1]
console.log(arr); // [1, 2, 3, 4, 5] (unchanged)
Practical Example
const letters = ['a', 'b', 'c'];
console.log(letters.toReversed()); // ['c', 'b', 'a']
Advanced Usage
const data = [{ v: 1 }, { v: 2 }, { v: 3 }];
const rev = data.toReversed();
console.log(rev[0].v); // 3

Understanding Array.prototype.toReversed

The Array.prototype.toReversed method in JavaScript returns a new array with the elements in reversed order, without modifying the original array. It belongs to the Array object and is one of the most widely used methods for working with array values in modern JavaScript and TypeScript applications.

The method signature is array.toReversed(). When called, it returns a new reversed array. Understanding when and how to use toReversed() helps you write more expressive, readable code.

Common use cases for Array.prototype.toReversed include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like array-reverse, array-tosorted, array-tospliced, enabling you to chain operations together for complex data manipulation pipelines.

Supported in Chrome 110+, Firefox 115+, Safari 16+, Edge 110+, and Node.js 20+.

Browser Compatibility

Supported in Chrome 110+, Firefox 115+, Safari 16+, Edge 110+, and Node.js 20+.

Related Methods

More Array Methods

Other methods in the Array object

Related Tools

More Array Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.