Javascript has a reverse() method that you can call in an array

var a = [3,5,7,8];
a.reverse(); // 8 7 5 3

Not sure if that's what you mean by 'libraries you can't use', I'm guessing something to do with practice. If that's the case, you can implement your own version of .reverse()

function reverseArr(input) {
    var ret = new Array;
    for(var i = input.length-1; i >= 0; i--) {
        ret.push(input[i]);
    }
    return ret;
}

var a = [3,5,7,8]
var b = reverseArr(a);

Do note that the built-in .reverse() method operates on the original array, thus you don't need to reassign a.

Answer from Andreas Wong on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › reverse
Array.prototype.reverse() - JavaScript | MDN
The reverse() method of Array instances reverses an array in place and returns the reference to the same array, the first array element now becoming the last, and the last array element becoming the first. In other words, elements order in the array will be turned towards the direction opposite ...
🌐
W3Schools
w3schools.com › jsref › jsref_reverse.asp
W3Schools.com
The reverse() method overwrites the original array.
🌐
Medium
josephcardillo.medium.com › how-to-reverse-arrays-in-javascript-without-using-reverse-ae995904efbe
How to Reverse Arrays in JavaScript Without Using .reverse() | by Joe Cardillo | Medium
January 31, 2022 - The first, reverseArray, takes an array as an argument and produces a new array that has the same elements in the inverse order. The second, reverseArrayInPlace, does what the reverse method does: it modifies the array given as argument in order ...
🌐
freeCodeCamp
freecodecamp.org › news › how-to-reverse-an-array-in-javascript-js-reverse-function
How to Reverse an Array in JavaScript – JS .reverse() Function
November 29, 2022 - By Dillion Megida In this article, I'll show you two ways to reverse arrays in JavaScript. The reverse method of arrays reverses an array by making the last item the first, and making the first item the last. The other items in between also ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › reverse-an-array-in-javascript
Reverse an Array in JavaScript - GeeksforGeeks
JS Tutorial · Web Tutorial · ... JavaScript · JavaScript provides a built-in array method called reverse() that reverses the elements of the array in place....
Published   July 23, 2025
Find elsewhere
🌐
Reddit
reddit.com › r/learnjavascript › how do i reverse an array?
How do I reverse an array? : r/learnjavascript
February 10, 2022 - Try putting quotes around each item. "Item1", "Item2", "Item3" and then using the array.reverse() method.
🌐
CoreUI
coreui.io › answers › how-to-reverse-an-array-in-javascript
How to reverse an array in JavaScript · CoreUI
May 14, 2026 - Use the reverse() method to flip the order of elements in a JavaScript array from last to first position.
🌐
Flexiple
flexiple.com › javascript › how-to-reverse-an-array
How to Reverse an Array In JavaScript – JS .reverse() Function - Flexiple
To reverse an array using a for loop in JavaScript. Begin by declaring an empty array that will hold the reversed elements. This new array is essential for storing elements in reverse order.
🌐
JavaScript in Plain English
javascript.plainenglish.io › javascript-reverse-array-without-modifying-dac063623490
How to Reverse an Array without Modifying in JavaScript | by Tari Ibaba | JavaScript in Plain English
August 21, 2024 - To reverse an array without modifying the original, we can clone the array with the slice() method and reverse the clone with the reverse() method.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › TypedArray › reverse
TypedArray.prototype.reverse() - JavaScript | MDN
July 10, 2025 - In other words, elements order in the typed array will be turned towards the direction opposite to that previously stated. This method has the same algorithm as Array.prototype.reverse(). const uint8 = new Uint8Array([1, 2, 3]); uint8.reverse(); console.log(uint8); // Expected output: Uint8Array [3, 2, 1] js ·
🌐
Favtutor
favtutor.com › articles › reverse-array-javascript
Reverse an Array in JavaScript | reverse() method
December 4, 2023 - Inside the function, we use the unshift() method to add the currentValue to the beginning of the accumulator array, effectively reversing the order of the elements. Finally, we return the accumulator array as the result of the reduce() method.
🌐
SitePoint
sitepoint.com › javascript
Reversing a JavaScript array without .reverse() / code explanation - JavaScript - SitePoint Forums | Web Development & Design Community
December 28, 2017 - I was working on a problem on Codewars.com and I stumbled upon an interesting solution on StackOverflow. Someone was asking how to reverse an array WITHOUT using .reverse(). Here is one solution someone wrote: let reverse=a=>[...a].map(a.pop,a) It helps me to look at it like this: (but I still don’t completely understand it) let reverse = (a) => { return [...a].map(a.pop, a); }; Original thread on StackOverflow I have used the spread operator, but not in this situation.
🌐
Medium
medium.com › swlh › javascript-three-ways-to-reverse-an-array-32f9819e9a97
JavaScript: Three Ways to Reverse an Array | by Bahay Gulle Bilgi | The Startup | Medium
August 15, 2020 - Reversing an array in different ways is one of the most popular questions you can expect to get at a JavaScript interview. In this article, I will present three ways to reverse an array, and using a built-in reverse method is not going to be one of them. This method reverses an array by modifying it, which means the first element in the original array becomes the last element and the last one becomes the first.
🌐
Quora
quora.com › What-is-the-most-efficient-way-to-reverse-a-Javascript-array
What is the most efficient way to reverse a Javascript array? - Quora
Answer (1 of 15): 1. Defining the need to reverse will produce much better answers and solutions. 2. Efficient to whom or what and does it matter to whom or what and why? 3. Avoid sorting large arrays in Javascript running in a web browser. 4. Reverse sorting choices: A dozen ways and counting...
🌐
ReqBin
reqbin.com › code › javascript › rgwrzonz › javascript-reverse-array-example
How do I reverse an array in JavaScript?
The array.reverse() method in JavaScript is used to reverse an array in place. The reverse() method reverses the array immediately; this means that the original elements of the array are swapped, and the original sequence is lost.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-array-reverse-method
JavaScript Array reverse() Method - GeeksforGeeks
July 14, 2024 - JS Tutorial · Web Tutorial · ... Updated : 14 Jul, 2024 · The JavaScript Array reverse() method reverses the order of the elements in an array in place....
🌐
Alexanderkaran
blog.alexanderkaran.com › reversing-arrays-in-javascript
Reversing Arrays in JavaScript
August 20, 2023 - The first method is Array.prototype.reverse() which reverses the array in place, meaning we change the original array.
🌐
DEV Community
dev.to › shubhamtiwari909 › javascript-reverse-method-4aa7
Array Methods in JS - reverse() - DEV Community
August 21, 2022 - Hello Guys today i will discuss reverse() array method in javascript reverse() method is used to reverse array elements
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Array › reverse
JavaScript Array reverse() - Reverse Array Order | Vultr Docs
September 27, 2024 - The reverse() method in JavaScript is a straightforward and powerful function used to reverse the order of elements within an array.