1function reverseString(s){
2 return s.split("").reverse().join("");
3}
4reverseString("Hello");//"olleH"
1function reverse(str){
2 let reversed = "";
3 for (var i = str.length - 1; i >= 0; i--){
4 reversed += str[i];
5 }
6 return reversed;
7}
1function reverseString(str) {
2 var newString = "";
3 for (var i = str.length - 1; i >= 0; i--) {
4 newString += str[i];
5 }
6 return newString;
7}
8reverseString('hello');
1function reverseString(s){
2 return s.split("").reverse().join("");
3}
4reverseString("Hello");//"olleH"
1var s = userInput[0];
2var rev = [];
3for(let i=0;i<s.length;i++)
4{
5 rev.push(s[s.length-1-i]);
6}
7console.log(rev.join(""));