• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Miscellaneous / Reverse the order of items in an array

Reverse the order of items in an array

Reverse the order of items in an array

Reverse the order of items in an array.

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

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

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

Source

https://vanillajstoolkit.com/reference/arrays/array-reverse/

Miscellaneous

Related Snippets:

  • How To Get All Unique Values and Remove Duplicates in a JavaScript Array
  • Wrap an element around a given element
  • Take the content of an array and return a single value
  • Looping over an object’s keys and values

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers