Is this an array or an object in Javascript?
<p>Could someone explain this block of code to me and what the type of 'arr' is.
I know that an array is an object but</p>

<ol>
<li>Why does the <strong>[[Class]]</strong> show up as Array if it behaves like an Object</li>
<li><p>arr.length returns 3. How?</p>

<pre><code>var arr = [0, 1, 3];
arr.name = "asdf";

console.log(arr[1] + " " + arr.name + " " + arr.length); 
// Returns-&gt; 1 asdf 3

Object.prototype.toString.call(arr); 
// Returns-&gt; "[object Array]"
</code></pre></li>
</ol>

<p>Whats the deal here?</p>

<hr>

<p>This has already been answered in good detail in this SO post </p>

<p><a href="http://stackoverflow.com/questions/5048371/are-javascript-arrays-primitives-strings-objects">Are Javascript arrays primitives? Strings? Objects?</a></p>
