Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 03:52
Show Gist options
  • Save masautt/bc26c58dfc81a60c39ba731943b66a13 to your computer and use it in GitHub Desktop.
Save masautt/bc26c58dfc81a60c39ba731943b66a13 to your computer and use it in GitHub Desktop.
How to reverse string in JavaScript?
let str = "marek";
console.log(str.split("").reverse().join("")); // --> "keram"
// Takes string, splits into char array, reverses array, then joins back to string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment