You have to loop from 0 to i < colCount. In JavaScript, and many other language, the indexing starts from zero.
Look:
Loop through an array in JavaScript
Answer from mico on Stack OverflowFirebug is no longer being maintained. From getfirebug.com:
The Firebug extension isn't being developed or maintained any longer. We invite you to use the Firefox DevTools instead, which ship with Firebug.next
See also Migration from Firebug guide.
Further to Domenic D.'s answer, I thought it might help others to give a fuller explanation.
It's showing 'undefined' because that's the return value of the function console.log().
It isn't outputting 'test' into the console because Firebug is no longer maintained and doesn't support the latest versions of Firefox. One of the problems I've noticed as a result of this, is that logging using console.log() doesn't show up in the Firebug console anymore.
Unfortunately (if you are used to Firebug), the solution is to use Firefox's built in developer tools instead.
To load the console using Firefox's built in tools, press ctrl+shift+k. Here, console.log() will work as expected. For example, running console.log('test') as you have above, will output 'test', then undefined (the return value of console.log()).