// Get String From The Page// controller functionfunctiongetValue(){
document.getElementById("alert").classList.add("invisible");let userString = document.getElementById("stringInput").value;let revString =reverseString(userString);displayString(revString);}// Write Function That Reverses The String// logic functionfunctionreverseString(userString){let revString =[];// reverse a string using a for loopfor(let index = userString.length -1; index >=0; index--){
revString += userString[index];}return revString;}// Display The Message To The User// view functionfunctiondisplayString(revstring){//write to page
document.getElementById("message").innerHTML =`Your String Reversed Is: ${revstring}`;//show the alert box
document.getElementById("alert").classList.remove("invisible");}