Difference in javascript alert and doocuent.write method
<p>What is the difference in <code>document.write()</code> method and<code>window.alert()</code>?</p>

<pre><code>var arr=new Array("Maizere","Pathak");

// with document.write() method the array element gets printed:
document.write(arr);
&gt; output: Maizere,Pathak
</code></pre>

<p>Also with alert,values gets alerted</p>

<pre><code>alert(arr);
&gt; output: maizere,pathak
</code></pre>

<p>Why are both printing the values?shouldn't alert print <code>Object Object</code>?
With DOM object it prints [object HTML collection] and here it is printing values</p>
