Steps to get the solution: 1. Idea is to place last item of string at the start and then run reverse function on 1st to 2nd last item of string 2. we have to repeat this until we get string parameter in recursive function as empty. 3. If string parameter in recursive function is empty that means we reached the end and we can return the result. Code:

function reverse(str) {
  if(str == '') { 
    return '';
  }
  else {  
  lastIndex= str.length-1;
  return str[lastIndex]+ reverse(str.substring(0,lastIndex));
  }
}

let str = 'test'
let result = reverse(str);
console.log('result', result); //output:  tset