Loop through Javascript array, print with string.
- by Adam
I have a simple array like:
var myArr=["one","two","three"];
an I have a counting loop, which increases the value of var "i" by one.
What I want to do is print the next value from the array each time the loop runs, next to a text string, like so:
alert('value number '+myArr[i]+);
But for some reason I can't get this to work.
The following code works, so I'm assuming I'm not calling the counter right:
alert('value number '+myArr[0]+);