Tell us what’s happening:
Can’t understand where I’m going wrong.
Your code so far
function reverseString(str) {
let h = '';
for(let i = 0; i < str.length; i++){
h = h + str[length - 1 -i];
}
return h;
}
reverseString("hello");
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string