Created
January 2, 2022 06:52
-
-
Save Sanchithasharma/61b02c9264716be63f141a2ec43eed6f to your computer and use it in GitHub Desktop.
Reverse string in JavaScript (convert string to array, reverse and join it)
This file contains 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
function reverseString(str) { | |
return str.split('').reverse().join(''); | |
} | |
reverseString("hello"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment