Javascript TypeError: Cannot call method 'getSize' of undefined
<p>I have been working with javascript lately and I am using Chrome (12) Developer tools and I have been getting the error:</p>

<pre><code>TypeError: Cannot call method 'getSize' of undefined.
</code></pre>

<p>I have no idea of why this is happening but have isolated the part which seems to be the problem:</p>

<pre><code>    x = 0;
    for(var i=0; i&lt;w; i++){
        for(var j=0; j&lt;h; j++) {
            display.blit(tile[world[x]], [(i * 34), (j * 34)])
            x++;
            }   
    }
</code></pre>

<p>the x++; give me the error and when I comment out the code (of x++;) chrome says there are no errors. Display.blit(tile[world[x]], [(i * 34), (j*34)] doesn't seem to have anything to do with the error although I may be wrong.</p>

<p>My question is how to fix this error and why it is happening in the first place.</p>
