I think you really need to learn some JavaScript basics, it really would help you a lot, I see you are saying that condole.log() does not work, did you try CTRL(control Key) + F12 or FN + F12 depending on your keyboard, then navigate to the "Console" Tab of your browser's Developer tools? I think that would help.

Please understand that Console.log() is more like your document.write() but the difference is that document.write() will write the output to the page(document) that you are viewing whereas Console.log() will write on the Browsers console.

The poster above has posted something that I don't even understand. I believe that's somewhat throwing a toddler in the deep end of a pool and relying entirely on his floaties. I advise you learn the basics of JavaScript, I know that knowing Java helped me but even that didn't prepare me for something like:

var arrayName = ["String 1", "String 2", "String 3"];

for(var x in arrayName) { console.log(x);}

That would loop through the array in the same way as I demonstrated in my above post. The difference is simply the way the for loop is made. Each language has it's own quirks, processes and most importantly, functions. Make sure that you learn that language properly, don't just dive into the heavier stuff. It might take longer but it's safer.

When working with arrays most (if not all) of the time, your array will start at 0 and not one. So when we know we have 5 values in front of us, we count it as 1, 2, 3, 4, 5 -- the computer however, counts it as 0, 1, 2, 3, 4. arrayname.length however is a method that returns the count of the variables in the array, starting at 1 and not 0, so it would return a value of 5 because we have 5 values in the array.

Because the loop posted is counting from 0 (i=0) we want to use the same counting scheme as the computer. If the loop's termination condition was i=arrayname.length, we would run in to an Out of Bounds error, because the program we're writing would look for a 6th value which doesn't exist. That's why if our counter variable starts at 0, our termination condition is always < the length of the array.

That's where the poster above you got < arrayname.length from.

As for console.log will work for you if you're using a debugging tool like FireBug for Firefox or the inbuilt debugger for Chrome (if you're using Chrome, all you need to do is right click anywhere on the page, and then click on "Inspect Element". In the window that appears at the bottom of the screen, click on the Console tab. Anything console.log outputs can be found there.)