I know I have to use .reverse(); and I imagine that the first thing I have to do is also pass the string given in the parameter to an array, but I don't know how I could do it or in what order. I leave my code below.
function reverseString(str) {
return str;
}
reverseString("hello");
Beforehand thank you very much.
(What I want is that if I put "hello" as a parameter when returning the value it says "olleh").
This is a method to do what you want:
I am writing you a method since there are actually different ways to do this, I recommend this article, where you can find 10 ways to do it, made by Edd Mann : http://eddmann.com/posts/ten-ways-to-reverse -a-string-in-javascript/
1: Decrementing for-loop with concatenation
10: