I have an array positioned "globally" (outside of any function in my document).
var arrayBidimensional;
Next, I am attempting to fill it like this:
var objectLetter = new objectLetter("","","","","");
arrayBidimensional = new Array(size);
for (i = 0; i < size; i++)
arrayBidimensional[i] = new Array(size);
var random = Math.floor((Math.random()*26) + 0);
for (var i = size - 1; i >= 0; i--)
{
for (var j = size - 1; j >= 0; j--)
{
random = Math.floor((Math.random()*26) + 0);
objectLetter.letter = letters[random];
objectLetter.letterPosX = j;
objectLetter.letterPosY = i;
objectLetter.wordShape = "no";
objectLetter.identifier = j + "" + i;
arrayBidimensional[i][j] = objectLetter;
}
}
However, when I try to access this array at a specific position like array[X][X]
all I get is the value from the very first position. For example, if the first position (0,0) is "A", then the entire array displays "A" at every position, even [(max position), (max position)].
How do I know this? Well, I am constructing a table with td elements like this:
'<td width="30">' + arrayBidimensional[i][j].letter + '</td>'
Consequently, the entire table just shows "A" in every cell... So... What am I doing wrong?
Your assistance on this matter is greatly appreciated! Thank you.