Why does console.log() and display.write() output different results for a two-dimensional array in JavaScript?
<p>I'm trying to understand the ins and outs of a two-dimensional arrays in JavaScript. While debugging I've noticed a difference in the values when outputting with console.log() and display.write().</p>

<p>I understand I should be using console.log(), however it seems I could only get display.write() to output what I was expecting.</p>

<pre><code>var x = [];
  for (var i = 0; i &lt; 5; i++) {
    x[i] = new Array(1);           
  }
    x[0][0] = "A";
    x[0][1] = "Apple";
    x[1][0] = "B";
    x[1][1] = "Banana";
    x[2][0] = "C";
    x[2][1] = "Cumquats";
    x[3][0] = "D";
    x[3][1] = "Dewberry";
    x[4][0] = "E";
    x[4][1] = "Elderberry";

document.write(x);
console.log(x);
</code></pre>

<p>I see the following from <strong>document.write(x)</strong>:</p>

<pre><code>A,Apple,B,Banana,C,Cumquats,D,Dewberry,E,Elderberry
</code></pre>

<p>I see the following from <strong>console.log(x)</strong>:</p>

<pre><code>[Array[2], Array[2], Array[2], Array[2], Array[2]]
</code></pre>
