JavaScript (ES2026) reference · Array Methods

JavaScript Array reverse() Method

Reverse the array in place and return it. Use toReversed() to get a reversed copy instead.

JavaScript (ES2026) Since ES1

Syntax

array.reverse()

Return value

The same, reversed array.

Examples

Reverse in placeTry it yourself
const steps = [1, 2, 3];
steps.reverse();
console.log(steps);

Output

[ 3, 2, 1 ]
Keep the original with toReversed()Try it yourself
const original = [1, 2, 3];
const copy = original.toReversed(); // ES2023
console.log(original, copy);

Output

[ 1, 2, 3 ] [ 3, 2, 1 ]

Version history

VersionChange
JavaScript ES1Added

In other languages