Using only the methods covered in the chapters preceding this exercise, here is my proposition.
function reverseString(str) {
return str == "" ? "" :
str.slice(-1) + reverseString(str.slice(0, -1));
}
Using only the methods covered in the chapters preceding this exercise, here is my proposition.
function reverseString(str) {
return str == "" ? "" :
str.slice(-1) + reverseString(str.slice(0, -1));
}