Reverse a String - Can't understand what is wrong with my code

Reverse a String - Can't understand what is wrong with my code
0

#1

I tried:

var reverseString = function(str) {
  var myArray = str;
  var reversed = myArray.reverse();
  return reversed;
};

reverseString("hello");

and

 function reverseString(str) {
   var myArray = str;
   var reversed = myArray.reverse();
   return reversed;
 } 
 reverseString("hello");

The result is the same: “myArray.reverse isn’t a function”.

I searched on Google and I know we can put two vars in the same function and I also checked on developer.mozilla.org the “var reversed” is correct.

Link to the challenge:


#2

reverse is an array method. str is a string. You’ll have to figure out how to convert the string to an array.