Tell us what’s happening:
Describe your issue in detail here.
So I’m trying to reverse this string by first doing a loop but when I check the result in console I keep getting an empty array.
Anyone know why this is?
**Your code so far**
function reverseString(str) {
let arr = [];
for (let i = (str.length - 1); i <= 0; i-- ){
arr.push(str[i])
}
return arr;
}
reverseString("hello");
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Reverse a String
Link to the challenge: