Created
September 6, 2019 03:49
-
-
Save masautt/36116cd6712763d2208cdd7160820c88 to your computer and use it in GitHub Desktop.
How to reverse array in JavaScript?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr = [1,2,3,4,5] | |
console.log(arr.reverse()); //--> [5,4,3,2,1] | |
// Performs on original array | |
console.log(arr); // --> [5,4,3,2,1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment