Which JavaScript method reverses the order of elements in an array?

The story behind the answer

The JavaScript method that reverses an array’s element order is reverse().

Called on an array, reverse() swaps the elements in place: the first becomes the last, the second becomes the second-to-last, and so on. For example, [1, 2, 3].reverse() produces [3, 2, 1]. The method returns a reference to the same array, rather than creating an independent copy.

That in-place behavior is the most important detail people get wrong. If the original array must remain unchanged, make a shallow copy first, such as [...items].reverse() or Array.from(items).reverse(). In modern JavaScript, toReversed() provides a non-mutating alternative and returns a reversed copy.

slice() creates a shallow copy and can help prepare an array for reversal, but it does not reverse anything by itself. concat() joins arrays or values, while sort() rearranges elements according to sorting rules; sort() can sometimes appear to reverse an array only when given a deliberately descending comparator. reverse() is also generic enough to work with array-like objects that have a length and integer-indexed properties.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: