reverse()

ES3+

Reverses an array in place and returns the reference to the same array.

Syntax

array.reverse()

Return Value

Array

The reversed array

Examples

JavaScript
const numbers = [1, 2, 3, 4, 5];
numbers.reverse();
console.log(numbers);
Output:
// [5, 4, 3, 2, 1]

Related Methods