The built-in reverse() method

const nums = [1, 2, 3, 4];
nums.reverse();
console.log(nums);  // [4, 3, 2, 1]

This is the fastest and clearest option, but notice it changes nums itself rather than returning a fresh array.

Reverse without mutating the original

const nums = [1, 2, 3, 4];
const flipped = [...nums].reverse();
console.log(nums);     // [1, 2, 3, 4]
console.log(flipped);  // [4, 3, 2, 1]

The spread operator makes a shallow copy first, so reverse() works on the copy and leaves your data untouched.

The modern toReversed() method

const nums = [1, 2, 3, 4];
const flipped = nums.toReversed();
console.log(flipped);  // [4, 3, 2, 1]

toReversed() is a newer addition that always returns a new array, so it is the cleanest choice when your environment supports it.

Which method should you use?

  • reverse() — fastest when you are happy to change the original.
  • [...arr].reverse() — the reliable way to keep the source array intact.
  • toReversed() — cleanest non-mutating option in modern runtimes.
  • Common mistake: calling reverse() and being surprised the original changed.

Frequently asked questions

Does reverse() change the original array?

Yes. reverse() mutates the array it is called on and returns that same array. Copy first with [...arr] or use toReversed() to avoid that.

How do I reverse a string instead?

Split it into characters, reverse, then join: str.split("").reverse().join("").

Want to get comfortable with array methods? Our free JavaScript course walks through them with live examples.