• 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:

  • Insert an element at the beginning of a set elements inside a shared parent
  • How To Insert An Item Into An Array Using JavaScript
  • Transform all text in a string to lowercase
  • Make a draggable element

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