Tell us what’s happening:
My 1st idea was to
convert the string to an array
use a for loop to go through each character over the array
use .pop() /.push() to change each letter to the end
then convert it to a string.
That didn’t seem to work
and I found out about reverse so I tried to implement that
yet it still fails
Your code so far
function reverseString(str) {
//convert the string into an array using split
//then reverses that array using the reverse
return str.split("").reverse().toString();
//then converts the array to a string again
}
reverseString("hello");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
.
Challenge: Reverse a String
Link to the challenge: