Tell us what’s happening:
Hello I’m getting the correct output from my code and this is the most efficient I can make it. Somehow I’m still failing to return a string for reverseString. It would be greatly appreciated if someone could help me out!
Your code so far
function reverseString(string) {let charArray = string.split(""); charArray.reverse();
let reversedString = charArray.join("");
console.log(reversedString);
}
reverseString("hello");
reverseString("Howdy");
reverseString("Greetings from Earth");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Build a String Inverter - Build a String Inverter