Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 03:49
Show Gist options
  • Save masautt/36116cd6712763d2208cdd7160820c88 to your computer and use it in GitHub Desktop.
Save masautt/36116cd6712763d2208cdd7160820c88 to your computer and use it in GitHub Desktop.
How to reverse array in JavaScript?
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