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
In other words, elements order in the array will be turned towards the direction opposite to that previously stated. To reverse the elements in an array without mutating the original array, use toReversed().
🌐
SamanthaMing
samanthaming.com › tidbits › 74-how-to-reverse-an-array
How to reverse an array in JavaScript? | SamanthaMing.com
const benjamin = ['👶', '👦', '👨', '👴']; const benjaminButton = benjamin.reverse(); console.log(benjaminButton); // ['👴', '👨', '👦', '👶'] ... One thing to note is that it mutates the original array.
🌐
Programiz
programiz.com › javascript › library › array › reverse
JavaScript Array reverse() (With Examples)
Note: The reverse() method reverses the order of elements in place, it means the method changes the original array. let languages = ["JavaScript", "Python", "C++", "Java", "Lua"];
🌐
W3Schools
w3schools.com › jsref › jsref_reverse.asp
JavaScript Array reverse() Method
The reverse() method reverses the order of the elements in an array.
🌐
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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array
Array - JavaScript | MDN
February 24, 2026 - Returns a new array with the elements in reversed order, without modifying the original array.
🌐
Flexiple
flexiple.com › javascript › how-to-reverse-an-array
How to Reverse an Array In JavaScript – JS .reverse() Function - Flexiple
June 6, 2024 - Reversing an array in JavaScript is a straightforward task using the reverse() function. This function directly modifies the original array by inverting the order of its elements.
Find elsewhere
🌐
Latenode
community.latenode.com › other questions › javascript
How can I reverse an array in JavaScript without modifying the original array? - JavaScript - Latenode Official Community
November 6, 2024 - The method Array.prototype.reverse changes the original array by reversing its elements. I’m looking for an easy way to reverse an array while ensuring that the original array remains unchanged. Is there a straightforwar…
🌐
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 ...
🌐
Educative
educative.io › answers › how-to-reverse-an-array-in-javascript
How to reverse an array in JavaScript
In JavaScript, reversing an array can be done using a built-in array method known as reverse().
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › reverse-an-array-in-javascript
Reverse an Array in JavaScript - GeeksforGeeks
JavaScript provides a built-in array method called reverse() that reverses the elements of the array in place.
Published   July 23, 2025
🌐
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.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-array-reverse-tutorial-with-example-js-code
JavaScript Reverse Array – Tutorial With Example JS Code
January 18, 2021 - When you need to reverse an array in JavaScript, you can use the reverse method, which will put the last element first and the first element last:
🌐
CoreUI
coreui.io › answers › how-to-reverse-an-array-in-javascript
How to reverse an array in JavaScript · CoreUI
September 20, 2025 - Use the reverse() method to flip the order of elements in a JavaScript array from last to first position.
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › program-to-reverse-an-array
Array Reverse - GeeksforGeeks
Auxiliary Space: O(1), no extra space is required, therefore we are reversing the array in-place. The idea is to use inbuilt reverse methods available across different languages.
Published   1 week ago
🌐
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.
🌐
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 ...