Array

Array.prototype.reverse

Reverses an array in place and returns the reversed array

Syntax

JavaScript
array.reverse()

Return Value

The reversed array (same reference)

Examples

Basic Usage
const arr = [1, 2, 3, 4, 5];
arr.reverse();
console.log(arr); // [5, 4, 3, 2, 1]
Practical Example
const letters = ['a', 'b', 'c'];
const reversed = [...letters].reverse();
console.log(reversed); // ['c', 'b', 'a']
console.log(letters); // ['a', 'b', 'c'] (unchanged)
Advanced Usage
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

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.