JavaScript Internals 101: arrays are just a special type of objects
<p>Internally, JavaScript has only objects (and primitive types). Objects are <strong>unordered</strong> collection of <code>key:value</code> pairs, where <code>key</code> is string and <code>value</code> can be any JavaScript type.</p>

<p>Arrays, though on the outside look like normal arrays of any other language, are actually a special case of objects, with natively supported language syntax.</p>

<p>Each array is an object where the key is a number and value can be any type. The keys are managed by JavaScript itself so that we can manipulate the array as an <strong>ordered</strong> collection of values. This is the reason we can use arrays in a <code>for-in</code> loop too. Additionally, JavaScript provides standard array operations (length, indexOf, splice, slice, join) as methods that take use the numbered keys to do their thing.</p>

<pre><code>&gt;&gt;&gt; typeof []
"object"

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

<p>Is my understanding correct, or am I missing something?</p>
