Currently, I'm attempting to populate a two-dimensional array in JavaScript using the following method:
var i = 0, j = 0;
for (i = 0; i < roomWidth / tileWidth; i += 1) {
roomBuffer[i] = [];
}
for (i = 0; roomWidth / tileWidth; i += 1) {
for (j = 0; j < roomHeight / tileHeight; j += 1) {
roomBuffer[i][j] = 1;
}
}
alert("Hello world");
The issue I'm encountering is that not only does this code fail to execute properly, but it also prevents any subsequent code from running. For example, the alert("Hello world");
does not appear. Could someone please advise on where I may be going wrong?