What will be the output of the following recursive function?
function reverseString(str) {
if (str === "") {
return "";
}
return reverseString(str.substr(1)) + str.charAt(0);
}
console.log(reverseString("hello"));
What will be the output of the following recursive function?
function reverseString(str) {
if (str === "") {
return "";
}
return reverseString(str.substr(1)) + str.charAt(0);
}
console.log(reverseString("hello"));