Answers for "reverse string with for loop"

1

reverse string with for loop

function reverseString(str) {
    var newString = "";
    for (var i = str.length - 1; i >= 0; i--) {
        newString += str[i];
    }
    return newString;
}
reverseString('hello');
Posted by: Guest on November-18-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language