Reverse a String - antoniojvargas/FreeCodeCamp GitHub Wiki

Reverse a String

Reverse the provided string.

You may need to turn the string into an array before you can reverse it.

Your result must be a string.

function reverseString(str) {
  var newArray = [];
  newArray = str.split("");
  newArray = newArray.reverse();
  str = newArray.join("");
  return str;
}

reverseString("hello");