Array.prototype.reverse
Reverses an array in place and returns the reversed array
Syntax
array.reverse()Return Value
The reversed array (same reference)
Examples
const arr = [1, 2, 3, 4, 5];
arr.reverse();
console.log(arr); // [5, 4, 3, 2, 1]const letters = ['a', 'b', 'c'];
const reversed = [...letters].reverse();
console.log(reversed); // ['c', 'b', 'a']
console.log(letters); // ['a', 'b', 'c'] (unchanged)const words = 'hello world'.split('').reverse().join('');
console.log(words); // 'dlrow olleh'Understanding Array.prototype.reverse
The Array.prototype.reverse method in JavaScript reverses an array in place and returns the reversed 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.reverse(). When called, it returns the reversed array (same reference). Understanding when and how to use reverse() helps you write more expressive, readable code.
Common use cases for Array.prototype.reverse include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like array-toreversed, array-sort, array-tosorted, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Array.prototype.reverse is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
Array.prototype.toReversedReturns a new array with the elements in reversed order, without modifying the original array
Array.prototype.sortSorts the elements of an array in place and returns the sorted array
Array.prototype.toSortedReturns a new array with the elements sorted in ascending order, 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.