How does JavaScript split() work in this case
<p>Following is some codes and output from the Chrome Developers' Console</p>

<p><strong>Case 1:</strong></p>

<pre><code>var myarr = document.location.hostname.split(".");    //typed
undefined                                             //output
myarr[0]                                              //typed
"ptamz"                                               //output: ONE
</code></pre>

<p><strong>Case 2:</strong></p>

<pre><code>var name = document.location.hostname.split(".");     //typed
undefined                                             //output
name[0]                                               //typed
"p"                                                   //output: TWO
</code></pre>

<p>Why are the two outputs (commented Output: ONE, and Output: TWO) different?</p>

<p>Screenshot:</p>

<p><img src="http://i.stack.imgur.com/zInEA.png" alt="enter image description here"></p>
