Created
October 22, 2022 19:39
-
-
Save oguzhancvdr/a44d84118de97aea9cb8c7572480d6a1 to your computer and use it in GitHub Desktop.
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
// for lightweight strings this is well-enough | |
const reverse = str => str.split('').reverse().join(''); | |
// more performant way for not lightweight strings :) | |
const reverseString = (string) => { | |
let reversedString = ""; | |
for (let i = string.length - 1; i >= 0; i--) | |
reversedString += string[i]; | |
return reversedString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reverse the String