JavaScript (ES2026) reference · Array Methods

JavaScript Array toReversed() Method

Return a new array with the elements in reverse order, leaving the original unchanged.

JavaScript (ES2026) Since ES2023

Syntax

array.toReversed()

Return value

A new array.

Examples

Reversed copyTry it yourself
const a = [1, 2, 3];
console.log(a.toReversed(), a);

Output

[ 3, 2, 1 ] [ 1, 2, 3 ]
Loop backwards without changing the arrayTry it yourself
const steps = ["mix", "bake", "serve"];
for (const s of steps.toReversed()) console.log(s);

Output

serve
bake
mix

Version history

VersionChange
JavaScript ES2023Added