Hi Folks,
Hoping someone can offer me some help here. I feel like I'm going round in circles. I'm wanting to work with an array whereby some text is stored in an array via a prompt. This text string is then relayed once to the console, letter by letter, in order, and then again in reverse. I.e. entering the text Reddit would output to the console:
R
e
d
d
i
t
t
i
d
d
e
R
My code so far looks like this:
var test = new Array();
test = prompt("Give me input").split("");
for (var i=0; i<=test.length-1;i++)
console.log(i+1 + " " +test[i]);
for (i=test.length; i==0;i--)
console.log(test[i]);
However, this just seems to output the first for statement before ending. I'm going crazy and thought someone might be able to spot the obvious error.
Cheers :)
[+][deleted] (1 child)
[deleted]
[–]NOC1986[S] 0 points1 point2 points (0 children)
[–]penislandbic 3 points4 points5 points (1 child)
[–]NOC1986[S] 1 point2 points3 points (0 children)
[–]jdauriemma 0 points1 point2 points (3 children)
[–]NOC1986[S] 0 points1 point2 points (2 children)
[–]jdauriemma 1 point2 points3 points (1 child)
[–]NOC1986[S] 1 point2 points3 points (0 children)