Skip to content

Instantly share code, notes, and snippets.

@dragonza
Created January 25, 2018 06:34
Show Gist options
  • Save dragonza/54f06c3e9eed0016311c36a7290a1164 to your computer and use it in GitHub Desktop.
Save dragonza/54f06c3e9eed0016311c36a7290a1164 to your computer and use it in GitHub Desktop.
String reversal with for loop
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