Array.prototype.toReversed
Returns a new array with the elements in reversed order, without modifying the original array
Syntax
array.toReversed()Return Value
A new reversed array
Examples
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)const letters = ['a', 'b', 'c'];
console.log(letters.toReversed()); // ['c', 'b', 'a']const data = [{ v: 1 }, { v: 2 }, { v: 3 }];
const rev = data.toReversed();
console.log(rev[0].v); // 3Understanding 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
Array.prototype.reverseReverses an array in place and returns the reversed array
Array.prototype.toSortedReturns a new array with the elements sorted in ascending order, without modifying the original array
Array.prototype.toSplicedReturns a new array with some elements removed and/or replaced at a given index, without modifying the original array
Array.prototype.withReturns a new array with the element at the given index replaced with the given value, without modifying the original array
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.