My code:
function reverseString(str) {
var arr=[];
for(var i=0;i<str.length;i++)
{
arr[i]=str[str.length-1-i];
}
arr.join('');
return arr;
}
I wonder why when I do the arr.join
, I still get the separated array and not the connected word. I know its possible to do with str.split("").reverse().join("").
Thanks!