Reverse a String- cant figure out last one

Tell us what’s happening:
Cant figure out how to keep the original spaces in the last check mark: reverseString(“Greetings from Earth”) should return “htraE morf sgniteerG”

Your code so far


function reverseString(str) {
  let res = [];
  let res2 = [];
  res = [...str.split("")];
     let love;
  res2.push(res.pop());
  res2.push(res.pop());
  res2.push(res.pop());
  res2.push(res.pop());
  res2.push(res.pop());

  //console.log(res2);
  //console.log(res2.join(''));
  str = res2.join('');
  console.log(str);
  return str;
}

reverseString("hello");

Your browser information:

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

Well, one huge problem is that your solution only works if your input string is 5 characters long. I might suggest you look into the reverse method.

You are making your code so much complicated