Reverse a String coding challenge

How can I write this function to work for all strings to be reversed?

Your code so far


function reverseString(str) {
  var str="Hello";
  var chars=str.split('');
  var reversed=chars.reverse();
      str=reversed.join('');
  return str;
}

function reverseString(str) {
  var str="hello";
  var chars=str.split('');
  var reversed=chars.reverse();
  var str=reversed.join('');
  return str;
}
reverseString("Howdy");
console.log(reverseString("Howdy"))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string/

Why are you doing this?

var str = "hello";

Remove that declaration/assignment and you will pass. Remember str is a parameter and when the function is called the strings are passed as arguments to it.