Best practice when using dot and bracket notation
<p>I have the following JavaScript code:</p>

<pre><code>var name = ui.item.label.split('. ', 2);
name.lastname  = name[0];
name.firstname = name[1];
</code></pre>

<p>The <code>split()</code> method is used to split a string into an array of substrings, and returns the new array. However, I want to reference the array associatively. So, I re-assigned name as shown above.</p>

<p>Did I just add two more elements to the name array or say are <code>name[0]</code> and <code>name.lastname</code> the same element?</p>

<p>If I'm correct I created the following array of length 4...</p>

<pre><code>name.0
name.1
name.lastname
name.firstname
</code></pre>
