
var getString= prompt("Please enter your name", "HarryPotter");
  
function reverseStr(str) {
    var splitString = str.split("");  
    var reverseArray = splitString.reverse(); 
    var joinArray = reverseArray.join("");     
    return joinArray;
}
 
console.log(reverseStr(getString));