Reverse a string in java script

Tell us what’s happening:

what is the problemis not yet passing the tests
Your code so far


function reverseString(str) {
var reversedString="";
for(var i=str.lenth-1;i>=0;i--){
  reversedString+=str[i];
}
 return reversedString;
}


console.log(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/87.0.4280.88 Safari/537.36.

Challenge: Reverse a String

Link to the challenge:

Hello @nharsha569. It is str.length not str.lenth.

is that how you write it?

Hello !

As specified by @nibble, it will be str.length instead of str.lenth. You are having a syntax error.

Hope it helps.