JS: Array.prototype.reverse

By Xah Lee. Date: . Last updated: .
xArray.reverse()
  • Reverse the order of elements of array.
  • Return the modified array.
  • The original is changed.
const xx = [3, 4, 5];

console.log(xx.reverse());
// [ 5, 4, 3 ]

// original is changed
console.log(xx);
// [ 5, 4, 3 ]

JavaScript. Sort, Reverse