There are a couple ways you could do this. An array (like you mentioned) is plausible, but frankly the same effect could be given by simply using a string.
var $rows = 5;
var $cols = "";
for(var $a = 0; $a < $rows; $a++) {
$cols += " * ";
document.write($cols+"<br />");
}
As a side note, you could wrap the $cols variable in <p> tags rather than use a line-break, it's really up to your preference.
While that's probably the simplest way I can think of at the moment, you could probably come up with variations or completely different versions if you'd like. I'd also like to address your issue with increasing the array number. Typically I like to use the .length property to add new items to an array. However you can also use the push() method to essentially do the same thing. Something like:
var $myArray = [];
$myArray[$myArray.length] = "This is a new item added to the end of an array"; // .length property
$myArray.push("This is another new item added to the end of an array"); // .push() method