Skip to main content Accessibility Feedback

Arrays

Array.prototype.reverse()

Reverse the order of items in an array.

let count = [1, 2, 3, 4, 5];

// Reverse the array order
count.reverse();

// logs [5, 4, 3, 2, 1]
console.log(count);

Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.


Find this useful? You can support my work by purchasing an annual membership.