Example :
//Using inbuilt funtions function reverseAString(str) { let reveresedString = str.split("").reverse().join("") return reversedString; } console.log(reverseAString("hello")); //Prints: olleh
//Without using inbuilt function function reverseAString(str){ let reversedString=""; for(let i=str.length-1; i>=0; i--){ reversedString += str[i]; } return reversedString; } console.log(reverseAString("hello"));//Prints: olleh