What is the result of the following code that reverses a string?
function reverse(str) {
if (str === "") {
return str;
}
return reverse(str.substr(1)) + str[0];
}
console.log(reverse("hello"));
What is the result of the following code that reverses a string?
function reverse(str) {
if (str === "") {
return str;
}
return reverse(str.substr(1)) + str[0];
}
console.log(reverse("hello"));