Created
January 25, 2018 06:34
-
-
Save dragonza/54f06c3e9eed0016311c36a7290a1164 to your computer and use it in GitHub Desktop.
String reversal with for loop
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
function reverse(str) { | |
let reversed = ''; | |
for (var i = str.length - 1; i >= 0; i--) { | |
reversed += str[i]; | |
} | |
return reversed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment