Last active
March 14, 2019 15:12
-
-
Save colormono/8f1ab76baa94a40f26529e7f480d5cdb to your computer and use it in GitHub Desktop.
[Reverse a String] #JS
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 reverseString(str) { | |
| var new_str = ''; | |
| for(var i=0; i<str.length; i++){ | |
| var char = str.charAt(str.length-i-1); | |
| new_str = new_str + char; | |
| } | |
| return new_str; | |
| } | |
| reverseString("hello"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment