Tell us what’s happening:
i used this code for challenge and return the good result but the system not gave don’t see it as a correct Solution i know this Solution is so long and complex that the Solution I thought about first so i ask.
Your code so far
var arr=[];
function reverseString(str) {
for(let i=0; i<str.length;i++){
var a = str.charAt(i);
arr.unshift(a);
}
str="";
for(let j=0; j<arr.length;j++){
str +=arr[j];
}
return str;
}
console.log(reverseString("Greetings from Earth"));
reverseString("hello");
Link to the challenge: