 <h2>PROBLEM:</h2> <p>I'm betting that you have a one-dimensional array with strings stored in each. So your array actually looks like:</p> <pre><code>array ( [0] =&gt; '...', [1] =&gt; '.X.', [2] =&gt; '...' ) </code></pre> <p>When this is what you want:</p> <pre><code>array ( [0] =&gt; array ( [0] =&gt; '.', [1] =&gt; '.', [2] =&gt; '.' ), [1] =&gt; array ( [0] =&gt; '.', [1] =&gt; 'X', [2] =&gt; '.' ), [2] =&gt; array ( [0] =&gt; '.', [1] =&gt; '.', [2] =&gt; '.' ) ) </code></pre> <p><br /></p> <h2>SOLUTION:</h2> <p>When constructing your 2D array, make sure you explicitly declare each entry in <code>board</code> as an array. So to construct it, your code might look something like this:</p> <pre><code>board = new Array(); rows = 3; for (var i = 0; i &lt; rows; i++) board[i] = new Array('.', '.', '.'); </code></pre>