Tell us what’s happening:
Please help.
Whenever I run the test, I get it wrong but the console shows the right answers without the quotation marks. Would be much grateful
Your code so far
function reverseString(str) {
let arr = [];
let strarr = str.split("");
for (let i = strarr.length - 1; i >= 0; i --) {
arr.push(strarr[i]);
}
console.log(arr.join(""));
}
reverseString("Greetings from Earth");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
.
Challenge: Reverse a String
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string