how to load a 2d array in js?
<p>Okay, I'm trying to load a 2d array and having some problems. Here's my code:</p>

<pre><code>var blockSize = 30;

var level = new Array(new Array(0, 1, 0, 1, 0, 1, 0, 1, 0, 1), new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 0));

var blockArray = new Array(1);
blockArray[0] = new Array(1);

function readLevel() {
    for (var i = 0; i &lt; level.length; i++) {
        for (var j = 0; j &lt; level[i].length; j++) {
            var tempImg = new Image();
            tempImg.src = "images/block.png";
            blockArray[i][j] = new block(i * blockSize, j * blockSize, level[i][j], false, false, tempImg);

            //throw('blockArray['+i+']'+j+'] = ' + level[i][j]);
        }
    }
}
</code></pre>

<p>And here is my error:</p>

<pre><code>Firebug's log limit has been reached. 0 entries not shown.      Preferences  
blockArray[i] is undefined
[Break On This Error] blockArray[i][j] = new block(i *...level[i][j], false, false, tempImg); 
</code></pre>

<p>How do I fix this?</p>
