Reverse a String Algorithm

Tell us what’s happening:

how is posible that writing these piece of code function reverseString(str) {
return str.split(’’).reverse().join(’’);
} you get the test right taking into account that in any moment you write the variables : “hello”, and “Greetings from Earth”. I mean we shouldn´t store these variable first?.

thank you guys.

Your code so far

function reverseString(str) {
  return str;


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge: